jit.gl.pass + DoF problem

geoscle's icon

Dear all,

I've encountered some kind of problems while trying to apply DoF processing:

1. DAE/COLLADA
when loading .dae models I can get very fine results with focal_distance values between 0.1 and 0.6 and focal_range values between 0.9 and 1.28
DoF in this case works properly and sparkling.

2. OBJ MODELS
when loding almos every .obj model I've made or found on the web I can't get rid of "strange black squares" you can see picture even if
the DoF continue to works properly as for .dae files with same values

3. MAX7 GENERATED
when working with jit.gl.mesh with some jit.bfg to do vertex displacement or other generated stuff in Max7 like gridshape or something, there is no way to get the DoF working and it acts like generic "gaussian blur" shader but there is no "strange black squares".
I've tried rebuilding normals using all the tools I know from the @auto_normals attribute to jig.gen and jit.gencoord, scaling, rotating but there is no way to make it work properly.

Can't figure out if I'm missing something or is a bug,
thanks everybody for helping!

My PC:
Windows 10
Max7 64-bit / 32-bit
NVIDIA GTX 980M

Max Patch
Copy patch and select New From Clipboard in Max.

here's the patch I'm using

OBJ_Problems.jpg
jpg
daddymax's icon

I had a similar issue. If you just stick a jit.gl.pass object in your patch and use an effect like bloom, you are generally fine. With DOF, i found it only really works well if you hook it up using the architecture used in the helpfile for the jit,gl.pass object (with specific routing/ rendering videoplanes). used in isolation, DOF seemingly only gives an undifferentiated blurriness.

Rob Ramirez's icon

never seen the black squares before. feel free to send my a model file if you'd like me to try and reproduce.

jit.gl.pass @dof relies on the normals / depth buffer generated by jit.gl.material, so will only work with objects bound to a jit.gl.material object, or if you write a custom shader to calculate the normals and depth and write them to the second render target (depth should be stored in the alpha value, normals in the rgb).

Pis Pas's icon

Rob, can you please elaborate a bit more the second render part? Once we have the normal/depth map how will we pass this texture to the jit.gl.pass object?

Thanks

Rob Ramirez's icon

the jit.gl.pass dof effect will look into the second render target (gl_FragData[1]).
so in your object's custom shader, add something like the following:gl_FragData[1] = vec4(normalize(normal), depth);

Pis Pas's icon

Thanks a lot Rob !

I'm using #version 130 in the Fragment shader and I'm getting:

0(125) : error C5121: multiple bindings to output semantic "COL0"

Pis Pas's icon

Rob, a hint here would be very helpful :)

Rob Ramirez's icon

Jitter only supports Open GL version 2.1, and therefore only supports GLSL versions up to 120

Pis Pas's icon

Rob, switching to version 120 doesn't help either. I still get the same error:

error C5121: multiple bindings to output semantic "COL0"

Thanks!!

p.s: when will jitter be updated?

Rob Ramirez's icon

you have to debug your shader. can't help you with just an error string.

there are currently no plans to update the opengl version in jitter.

daddymax's icon

Sorry to resurrect an old thread, but i have the exact same problem (no model file, just a jit.gl.mesh with material) and running the default DOF jit.gl.pass shader over it and getting black squares. I dont fully understand the above instructions - any advice?