Jump to content

Floating props


Recommended Posts

And for the fields, if you have lots of props on different places, you can indeed have terrain adjusting wheat.

That sounds like a very inefficient approach to the problem. I think for that case it would almost be better to somehow adjust the mesh itself to conform to the terrain. We could also consider myconid's work with grass that was rendered by shaders.

Link to comment
Share on other sites

That sounds like a very inefficient approach to the problem. I think for that case it would almost be better to somehow adjust the mesh itself to conform to the terrain. We could also consider myconid's work with grass that was rendered by shaders.

I agree it wan't meant for this purpose, so there are probably better ways of doing it. Do you have a link to myconid's work?

Link to comment
Share on other sites

That sounds like a very inefficient approach to the problem. I think for that case it would almost be better to somehow adjust the mesh itself to conform to the terrain.

Could you explain further into this?

I also thought this system would allow cool looking wheat fields or even big patches of grass to conform into the terrain. In fact I thought that it could be possible to make like a "brush" type actor, which consists just in several prop points and modify the .xml for the prop points to spawn trees for the "tree brush", grass for the "grass brush", etc...

Link to comment
Share on other sites

I think brushes should certainly have a different implementation, you can't have it all in one actor, as you can't change the shape of an actor. So no matter what you choose, you'll always have parts that shouldn't be covered with grass, or parts that are covered twice (which is visible with highly transparent things like grass).

I also did some tests with walls using this system. Celtic walls are very well suited, as they have vertical wood parts that cover the seams perfectly. I use a short wall segment as unit segment (because I can't model, and thus had to use the shortest one available) and used it to make long wall segments (using it as a prop left and right). Here are some screenshots with the results.

post-15092-0-73227600-1373716978_thumb.ppost-15092-0-35681200-1373716999_thumb.ppost-15092-0-67227700-1373717028_thumb.p

I don't know if it's any good though, I would first like to inspect myconid's work on adapting meshes to the terrain.

Edited by sanderd17
Link to comment
Share on other sites

greenknight32, not noticable this far. For entities without floating props, there should be almost no performance impact (only a check to see if it has no such props), and for every prop that can have an offset, the terrain height is queried (just like for all regular actors) and applied with only minor extra calculations.

There is a small performance impact (as always), but when trying to calculate, the overhead of the performance calculation will make it impossible to do.

Link to comment
Share on other sites

For comparison I loaded up a save with Britons and had them build a wall on a steep slope - looked pretty bad. Your examples look much better.

Well, as I said, it's only possible for the celtic walls this far, other walls would require major design changes before it can work, so I don't think the artists will be able to do it (they're already very busy with the blacksmiths, the Ptolemaic buildings and units, and those extra animals, so re-designing walls is no priority).

Link to comment
Share on other sites

AFAIK there was none, I think historicbruno was referring to the work he did on a grass effect that could be somehow used for the wheat see (http://www.wildfiregames.com/forum/index.php?showtopic=16022&st=320#entry243190)

Right, that's what I was referring to. We could use a special texture and material for fields, to tell the shaders to render something like wheat there with terrain conforming. Maybe we wouldn't want exactly the grass effect from myconid's example, but still it seems appropriate for shaders to deal with.

Link to comment
Share on other sites

Generally I think for any object that would be aligning to the terrain in a "smooth" way (think field or wall), we'd need to adjust the mesh at placement, which is reasonably efficient. The problem is that the meshes will need subdivision (probably). If we do not want to adjust the mesh itself, we could give each vertex a "height displacement" value and the vertex shader would move the vertex accordingly, it's basically the same but it avoid changing the mesh (though not the mesh object, so I'm not sure it's actually interesting).

Link to comment
Share on other sites

Generally I think for any object that would be aligning to the terrain in a "smooth" way (think field or wall), we'd need to adjust the mesh at placement, which is reasonably efficient. The problem is that the meshes will need subdivision (probably). If we do not want to adjust the mesh itself, we could give each vertex a "height displacement" value and the vertex shader would move the vertex accordingly, it's basically the same but it avoid changing the mesh (though not the mesh object, so I'm not sure it's actually interesting).

I don't know how many points the original meshes have and how they are distributed. Since they are not made for smoothing purpose I assume they will not be very good. So the second would be better (as far as I understand it).

Maybe adding "bones" to those structures/actors might be another solution?

Edited by FeXoR
Link to comment
Share on other sites

Second solution still is per-vertex so still requires subdivision (unless we use geometry shaders but those are not really supported widely). Basically there's no way around it: if we want a mesh to conform to the terrain, we'll need clever subdivision.

Link to comment
Share on other sites

  • 2 weeks later...

Regarding terrain-flattening: I did a quick thing like here to experiment with it. It's purely visual (it doesn't affect pathfinding) and stateless (it can be recomputed from the sim heightmap plus the current list of entities with TerrainFlattener components, so there's nothing to be serialized in saved games or network-synchronised). Currently it averages the terrain heights in a circle around the building, with a falloff so the vertexes nearer the edges have less weight, and then it moves every vertex in that circle towards that average height (using the same falloff weight, so vertexes nearer the edges move much less). That means the area under the building remains mostly flat, while the area just outside the building slopes relatively smoothly towards it. (The normal build restrictions stop you placing a building too near a steep slope, so you can't distort the terrain too much anyway). That's easy to implement and probably helps with most cases of building on bumpy ground.

  • Like 1
Link to comment
Share on other sites

In the video it looks like it let you place the buildings on really steep places, but I guess is just for demonstration.

Yeah, that was in Atlas so it ignored the normal restrictions.

Incidentally, would scenario designers want a feature in Atlas to disable flattening on an individual building so they can have more manual control, rather than it applying universally? Or should flattening be disabled entirely for buildings placed in Atlas?

Is this something that can be applied to structure templates so that some buildings (notably walls) don't flatten terrain?

Yes - I'm expecting we'd put a <TerritoryFlattener/> component in template_structure.xml, then <TerritoryFlattener disable=""/> in wall templates etc. (And some templates might want to change other parameters from the default, which should be easy enough. The default will probably be to use the Footprint shape with some standard falloff curve around the edges, but some might increase/reduce the strength of the flattening effect, and sanderd17 suggested some might flatten toward the average slope rather than the average height, and I suppose docks should flatten towards the water height, etc.)

Link to comment
Share on other sites

Nice. I like the sound of that.

Incidentally, would scenario designers want a feature in Atlas to disable flattening on an individual building so they can have more manual control, rather than it applying universally? Or should flattening be disabled entirely for buildings placed in Atlas?

Thanks for asking. Yes we will need a way to disable flattening on buildings in Atlas, though I don't mind flattening being on by default if that's what everyone agrees to. Lets see what Mythos says, he's created most of the scenario maps.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...