historic_bruno Posted July 13, 2013 Report Share Posted July 13, 2013 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. Quote Link to comment Share on other sites More sharing options...
Mythos_Ruler Posted July 13, 2013 Report Share Posted July 13, 2013 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.Such an approach could be extended to wall segments as well. Quote Link to comment Share on other sites More sharing options...
FeXoR Posted July 13, 2013 Report Share Posted July 13, 2013 Such an approach could be extended to wall segments as well.That would indeed be very nice. Quote Link to comment Share on other sites More sharing options...
sanderd17 Posted July 13, 2013 Author Report Share Posted July 13, 2013 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? Quote Link to comment Share on other sites More sharing options...
Enrique Posted July 13, 2013 Report Share Posted July 13, 2013 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... Quote Link to comment Share on other sites More sharing options...
sanderd17 Posted July 13, 2013 Author Report Share Posted July 13, 2013 (edited) 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.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 July 13, 2013 by sanderd17 Quote Link to comment Share on other sites More sharing options...
Enrique Posted July 13, 2013 Report Share Posted July 13, 2013 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.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) Quote Link to comment Share on other sites More sharing options...
greenknight32 Posted July 14, 2013 Report Share Posted July 14, 2013 Looks good to me. Any performance impact? Quote Link to comment Share on other sites More sharing options...
sanderd17 Posted July 14, 2013 Author Report Share Posted July 14, 2013 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. Quote Link to comment Share on other sites More sharing options...
greenknight32 Posted July 15, 2013 Report Share Posted July 15, 2013 Didn't really think it would be a problem, but since inefficiency was brought up...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. Quote Link to comment Share on other sites More sharing options...
sanderd17 Posted July 15, 2013 Author Report Share Posted July 15, 2013 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). Quote Link to comment Share on other sites More sharing options...
historic_bruno Posted July 15, 2013 Report Share Posted July 15, 2013 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. Quote Link to comment Share on other sites More sharing options...
wraitii Posted July 16, 2013 Report Share Posted July 16, 2013 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). Quote Link to comment Share on other sites More sharing options...
FeXoR Posted July 16, 2013 Report Share Posted July 16, 2013 (edited) 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 July 16, 2013 by FeXoR Quote Link to comment Share on other sites More sharing options...
wraitii Posted July 16, 2013 Report Share Posted July 16, 2013 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. Quote Link to comment Share on other sites More sharing options...
sanderd17 Posted July 16, 2013 Author Report Share Posted July 16, 2013 Any chance a programmer can extend this to the Actor Editor?It looks like you don't need Windows anyway to get that in, with the next autobuild, you'll have it: http://trac.wildfiregames.com/changeset/13568(thanks to wraitii for committing it). Quote Link to comment Share on other sites More sharing options...
Enrique Posted July 27, 2013 Report Share Posted July 27, 2013 Found a "problem" with this approach: What happens if I bake the AO where the props are next to the wall, but when it's placed on uneven ground the prop is lower than its shadow? Quote Link to comment Share on other sites More sharing options...
historic_bruno Posted July 27, 2013 Report Share Posted July 27, 2013 AO and props is yucky and a major flaw of the current system Prop variants are maybe even worse? Almost as bad as having to rebake the AO texture (which is not really an intuitive process) when the model is updated. Quote Link to comment Share on other sites More sharing options...
Enrique Posted July 27, 2013 Report Share Posted July 27, 2013 Yes, prop variants is another non-AO-compatible feature, unless they're the same model and just different texture. My approach is going to be leaving the "varying height props" out of the AO baking. I hope they do not stand out too much. Quote Link to comment Share on other sites More sharing options...
Ykkrosh Posted July 30, 2013 Report Share Posted July 30, 2013 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. 1 Quote Link to comment Share on other sites More sharing options...
Enrique Posted July 30, 2013 Report Share Posted July 30, 2013 Wow. That looks awesome tbh. In the video it looks like it let you place the buildings on really steep places, but I guess is just for demonstration. If, like you said, building restrictions still the same, I think this is the way to go Quote Link to comment Share on other sites More sharing options...
Pureon Posted July 30, 2013 Report Share Posted July 30, 2013 Regarding terrain-flattening: I did a quick thing like here to experiment with it.Looks really good to me Is this something that can be applied to structure templates so that some buildings (notably walls) don't flatten terrain? Quote Link to comment Share on other sites More sharing options...
Ykkrosh Posted July 30, 2013 Report Share Posted July 30, 2013 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.) Quote Link to comment Share on other sites More sharing options...
Pureon Posted July 30, 2013 Report Share Posted July 30, 2013 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. Quote Link to comment Share on other sites More sharing options...
Mythos_Ruler Posted July 31, 2013 Report Share Posted July 31, 2013 I would say to look at it from the other way: Disabled in Atlas by default, with a 'Flatten' button in the UI to flatten the terrain beneath the selected building. Just an idea. (Posting this from the balcony of my condo overlooking the Gulf of Mexico!) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.