### Forward clustered and Single Pass Stereo Rendering

Posted:

**Thu Dec 06, 2018 9:02 pm**Hello! I need a little help with clustered forward.

While ago I implemented Single Pass Stereo Rendering (viewtopic.php?t=93686) its mainly vertex shader stuffs but I also have to do this adjustment to the pixel shader:

Things like this has to be done since with single pass stereo you are basically rendering using one camera, so stuffs for the right eye that depends on the camera parameters/position/etc has to be adjusted.

I am rendering both eyes to a single texture so thats why I am doing: so its 0 for the left eye and 1 for the right, and I can do specific stuffs for each eye

Now the problem... using single pass stereo breaks forward clustered, lights disappear as I move the camera/head and sometimes I can distinguish the cells

I partially fixed the problem by doing this (line ~88 of Forward3D_piece_ps.glsl):
This makes the left eye works perfectly, now I need to solve the right eye...

tbh I don't understand too much the algorithm so I just tried different values for FWDPLUS_APPLY_OFFSET_X, like adding/substracting 0.5, multiplying by many values, and some other stuffs etc with no success

please help!

Many many thanks in advance!

While ago I implemented Single Pass Stereo Rendering (viewtopic.php?t=93686) its mainly vertex shader stuffs but I also have to do this adjustment to the pixel shader:

(actually that 0.064 is now a 0.095 don't remember why, but that's not relevant)xrgo wrote: ↑Sun Oct 29, 2017 6:35 pmSo far working great, reflection looked weird/flat so I did this in the pixel shader:so the viewDir of the right side of the viewport get adjusted as much as I offseted the right instance (0.064)Code: Select all

`@property( single_pass_stereo ) vec3 viewDir = normalize( -(inPs.pos - vec3( float( gl_FragCoord.x > @value( half_screen_width ) )*0.064, 0, 0 ) ) ); @end @property( !single_pass_stereo ) vec3 viewDir = normalize( -inPs.pos ); @end`

[/code]

Things like this has to be done since with single pass stereo you are basically rendering using one camera, so stuffs for the right eye that depends on the camera parameters/position/etc has to be adjusted.

I am rendering both eyes to a single texture so thats why I am doing:

Code: Select all

`gl_FragCoord.x > @value( half_screen_width ) )`

Now the problem... using single pass stereo breaks forward clustered, lights disappear as I move the camera/head and sometimes I can distinguish the cells

I partially fixed the problem by doing this (line ~88 of Forward3D_piece_ps.glsl):

Code: Select all

`uint sampleOffset = sliceSkip + uint(floor( FWDPLUS_APPLY_OFFSET_X(gl_FragCoord.x) * passBuf.fwdScreenToGrid.x @property( single_pass_stereo ) *2 @end ));`

tbh I don't understand too much the algorithm so I just tried different values for FWDPLUS_APPLY_OFFSET_X, like adding/substracting 0.5, multiplying by many values, and some other stuffs etc with no success

please help!

Many many thanks in advance!