demostenes Posted November 18, 2012 Share Posted November 18, 2012 How to not render water inside of ship (see linked pictures)? Create some mask surface inside of ship slightly above sea level and use special material/shader on it to not render sea? Is it possible by using default shaders? Thanks. Edit: Btw, why is picture quality spoiled so much by upload here? It is much darker and lower res, but size in kb is same. Link to comment
ulf.schroeter Posted November 18, 2012 Share Posted November 18, 2012 We had a similar requirement for putting arbitrary "holes" into terrain surface geometry without re-tesselation, see post on Depth Clear Material. Finally I got this basically working, but this approach required patching UNIGINE engine render and material source code for explicit per-material depth test mode selection. For your special water use-case case a different approach might be possible by just modifying the base UNIGINE water material. Key idea would be to specify one or multiple simple clipping rectangle or ellipse definitions representing your water clipping regions by center coordinate x/y/witdh/length and simple 2D Z-rotation matrix (so clipping geometry can be rotated according to your ship heading) as two vec4 material shader parameters per clipping geometry. Then, within a customized water material fragment shader you could test each fragment coordinate against these clipping areas and discard all water surface pixels within these clipping regions. Added support of latest SDK for array material parameters (it is now possible to pass a lot of vectors into the shader from a material) Material::set|getParameterArray() might be helpful to provide multiple clippping regions. Material clipping region parameters then have to be updated on each frame according to the world position/orientation of your ships, so water pixels inside the hull will be clipped away. Link to comment
frustum Posted November 18, 2012 Share Posted November 18, 2012 Wait a bit. The implementation is in progress. Link to comment
ulf.schroeter Posted November 18, 2012 Share Posted November 18, 2012 Seems that you liked the idea :( Link to comment
frustum Posted November 18, 2012 Share Posted November 18, 2012 It will be a special WorldVolume node which will be able to deform water surface and grass object on vertex shader level. Box and ellipse shapes will be supported. The solution is almost ready. Link to comment
ulf.schroeter Posted November 18, 2012 Share Posted November 18, 2012 Wow, this sounds cool, so it will support grass clipping too ?! Great ! Link to comment
frustum Posted November 18, 2012 Share Posted November 18, 2012 WorldSpacer node will be available in the next SDK update. This object can trample grass and dry the water. 1 Link to comment
ulf.schroeter Posted November 18, 2012 Share Posted November 18, 2012 Very good solution for ObjectGrass, were simply pushing vertices below groud surface is no problem. In case of water this will also be an effective solution for modern container ships with rectangular storage rooms. For some other ships with more rounded hulls like above example it might not be so easy to find a good spacer approximation which will completely clip inside space without producing visible outside artifacts (at least when seen from underwater, were backfacing and pushed down polygons might become visible outside of the hull). Nevertheless great implementation work ! Link to comment
demostenes Posted November 18, 2012 Author Share Posted November 18, 2012 For some other ships with more rounded hulls like above example it might not be so easy to find a good spacer approximation which will completely clip inside space without producing visible outside artifacts (at least when seen from underwater, were backfacing and pushed down polygons might become visible outside of the hull). Nevertheless great implementation work ! Lets see, I will try it on our ship. Link to comment
ulf.schroeter Posted November 19, 2012 Share Posted November 19, 2012 Yep this seems to be a very good test case. Link to comment
danni.coy Posted November 27, 2012 Share Posted November 27, 2012 Would this object work for partical systems like the ones used for rain in the valley demo Link to comment
manguste Posted November 27, 2012 Share Posted November 27, 2012 In case of water this will also be an effective solution for modern container ships with rectangular storage rooms. For some other ships with more rounded hulls like above example it might not be so easy to find a good spacer approximation which will completely clip inside space without producing visible outside artifacts (at least when seen from underwater, were backfacing and pushed down polygons might become visible outside of the hull). Yep, it's a rough approximation. But of course you can check and turn WorldSpacer on only when the camera's inside the ship. Just in case, I know you know that :) Lets see, I will try it on our ship. Sure, try it out. Link to comment
manguste Posted November 27, 2012 Share Posted November 27, 2012 Would this object work for partical systems like the ones used for rain in the valley demo Danny, what's your use case that's not covered by clippers in particle systems? Link to comment
pascal.winistoerfer Posted November 27, 2012 Share Posted November 27, 2012 this is cool with the ability to cut out grass on the object. For example if a player places a house in our case.. cut the grass under it :) Link to comment
ulf.schroeter Posted November 30, 2012 Share Posted November 30, 2012 Yep, it's a rough approximation. But of course you can check and turn WorldSpacer on only when the camera's inside the ship. Just in case, I know you know that :) No, actually I missed this simple, but exellent idea ! Link to comment
danni.coy Posted February 5, 2013 Share Posted February 5, 2013 I can't seem to get this to work with ObjectWater or ObjectWaterMesh and I can't find an example to try in the SDK?... Is there anything I need to do except make sure the masks are compatible? Link to comment
danni.coy Posted February 5, 2013 Share Posted February 5, 2013 nevermind - we just found the material thing Link to comment
Recommended Posts