Multi scene / render combine with jit.gl.node - weird blending issues

Greg Finger's icon

I wanted to have two different [jit.gl.model]'s in the same scene, but render their lights individually/uniquely. Some forum exploring led me to learning about a multiple jit.render / jit.gl.node (one for each model and one for the background as well) / jit.gl.videoplane (two per node, one renders in its own windows and one renders in a shared window) system

I'm pretty sure I assembled and initiated everything correctly, but i'm getting a strange blending where the models aren't overlaid on top of the background, but instead blended with it. (see attachment)

I thought this could be a mistake in the rendering order, so I assigned each jit.gl.node with an @layer attribute, making the background layer 0, model 1 is layer 1, model 2 is layer 2.

However this didn't solve it either. I did find a temporary fix, where if I change the background's [jit.gl.videoplane] (the one sent to the final jit.window) @blend_mode attribute, it will render correctly. (see attachment)

"@blend_mode 1 7" looks the best and the most like how the [jit.noise] background should look, but its default is "6 7" which turns out much darker. No idea why.

I've attached my patch (and also copy compressed). This forum won't let me attach my model (.dae) file, i think the duck.dae model that come with Max should produce the same results. However, if someone wants to test with my model specifically i can send it / host it somewhere.

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

---------- edit ----------
ok i think i solved it. the @layer attribute needed to be on each of the jit.gl.videoplane that get rendered on the final/combined window, not on the nodes. also i don't think i need a separate render for the background, since i'm not doing any unique effects/lighting to it.
---------------------------
also if there's any suggestions on how to make my patch more efficient (do all the windows need to be visible?), that would be appreciated.

multiMask.maxpat
Max Patch
correct-blending.png
png
weird-blending1.png
png
Greg Finger's icon

i suppose this multi render / node system, only because I want to light objects without bleeding onto other objects, could be simplified to a single render if I was able to fine tune lights to only orbit around a single object. It seems a bit difficult to get that exact control. I've taken a look at multi.light.materials.maxpat already. Maybe I can explore that further if that method is possible / preferred.

------

explored this with a spot light tweaking the position and direction attributes, and kind of achieved what i wanted. however a lot of attention is needed to define the "bounds" of the light so it doesn't spill onto the second object. Also changing its depth and direction is not a linear motion, I wouldn't know how to figure out the equation that is needed to make the light orbit around an object at the same distance from the faces and also avoid any spillover. Is this where the "bounds" attribute comes in? There doesn't seem to be any information for it in the helpfile.

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

I've copy compressed this single render / experimental light setup (specifically i was using the duck.dae; light control is below each model)

Rob Ramirez's icon

there's no support for linking lights to specific objects in Jitter, other than disabling lighting on that object.

one solution would be to use two jit.gl.camera objects positioned far apart from each other (as many units as necessary to prevent light bleeding). you could the "mix" the output of these cameras using either the camera's @viewport attribute, or by capturing each camera to a texture (@capture 1), and displaying those textures on two side-by-side gl.videoplanes.

check out the gl.camera examples for some tips, mainly camera.viewport and camera.node.mixing.views

Greg Finger's icon

cool, i like the idea. i wonder how much smoother my patch would run by limiting it to one render object.

Greg Finger's icon
Max Patch
Copy patch and select New From Clipboard in Max.

So i was able to accomplish what you suggested:

and it works pretty great.

now i'm trying to work on shadows (and a floor boundary) to make it seem more like a 3D environment. The jitter example lights.shadow, is pretty awesome, but i'm not sure i can apply the same concept here since everything is spaced out differently. how would you suggest making this current patch environment more 3D/realistic? Sometimes my spot light's boundaries isn't a faded area, but rather a harsh cut. If you move the model on the left's (top of the patch) light position's x parameter to -20, you can see what i'm talking about.

thanks