grzegorz.glosny Posted October 19, 2012 Posted October 19, 2012 I need to create material that will render object in 2 passes. In first pass it should render front faces, back faces will be rendered in second pass. Due to lack of documenation on custom materials subject I'm forced to ask those questions here: 1. Is it possible to create material that will render object in 2 (or more) passes? 2. Is it possible to configure material pass to render only back, front or both sides of faces?
ulf.schroeter Posted October 19, 2012 Posted October 19, 2012 1. Is it possible to create material that will render object in 2 (or more) passes? UNIGINE has no customizable multi-pass rendering concept 2. Is it possible to configure material pass to render only back, front or both sides of faces? Material can be configured to render FRONT or BOTH (material option two-sided) sides of faces
grzegorz.glosny Posted October 22, 2012 Author Posted October 22, 2012 What I need is something like this: - clipping part is quite easy, problem lies in caps. Clipping mesh instead is not an option because it must be done in realtime and clipped meshes can be quite complicated.Is it possible to achieve this without rendering object multiple times in unigine?
ulf.schroeter Posted October 22, 2012 Posted October 22, 2012 The approach (see this forum) uses fragment shader calculations, so it should be possible to port it to a customize UNIGINE material. Without digging too much into the shader code I think the capping only works for spheres, not for arbitrary meshes.
frustum Posted October 22, 2012 Posted October 22, 2012 For spheres you can easily render this. Let's say you have a mesh which contains three surfaces (an inner sphere with the radius of 1, an outer sphere with the radius of 1 and a clipping plane 2x2). In the material there will be two parameters for the inner and outer sphere radii. Create two shaders: The first scales spheres by the specified radii and clips them via discard pixel shader instruction. The second performs plane shifting and clipping by calculating the ring segment on a plane.
grzegorz.glosny Posted October 25, 2012 Author Posted October 25, 2012 Thanks for replies, however as i mentioned "clipped meshes can be quite complicated". The only thing guaranteed is that those meshed are closed.
ulf.schroeter Posted October 25, 2012 Posted October 25, 2012 Thanks for replies, however as i mentioned "clipped meshes can be quite complicated". Well, that's the difference between simple and complex :) The provided sample only uses spheres were capping is simple to reconstruct in the shader. This is unfortunately not the case with general meshes...
manguste Posted October 30, 2012 Posted October 30, 2012 Agreed, I'm afraid it's not a trivial task to calculate on shaders. Sorry that can't be of much help here with the data provided.
Recommended Posts