Rendering only the Shadow from Stride / XR

Hi, I’m working on an XR Project, to combine real camera position + footage with vvvv gamma Stride generated visual.
And was wondering if anyone here knows a way to only get the shadow as texture, but not render the floor mesh.

Right now, I’m using crhomaKey to cut off the Green floor plane, but I don’t like the fact that it outputs a colored shadow.

I guess there is too much ambient light. Try with a single directional light and no skybox. Then you should get a hard dark shadow.

Or use texture fx to change green into black.

Everything quite hacky

Thanks @schlonzo , will try that out as well!!
What i really wanna do here is, to get the shadow pass and avoid using chromaKey.

Hmm, sounds like you need a custom shader, that accepts shadows but transparent on every other channel, post your scene i’ll take a look

Hey @antokhio , that’ll be awesome!!
Here is the link to the scene I’m working on right now.

Would be cool if we can specify Index ID of an object and say just hide the floor plane from the render. Or maybe a plane that renders the shadow but is invisible.

seems there is mem leak with this patch ;) after an hour:

Ok, so did a test with custom shader, obviously it doesn’t receive shadows by default, and seems it’s not going to help much, unless someone knows witch imports it should take.

Basically if you would use Material node, it would compile shader from some predefined components, but overriding those not obvious… Walking from Stride side of C# did’t relive any easy to hack solution…

So then i thought “why bother” let’s just simply override all materials on entities to white color, render with shadows, and then we just multiply that as a texture with original scene texture. But since all entities are mutable it also overrides the base render.

Anyways made quite fun util to override all materials in scene on runtime:
VL.Stride.OverrideMaterials.vl (16.1 KB)

If i have more time i will look on to Stride Source, to see maybe there is ways to override DiffuseModel but that would need compiled plug


Thanks @Antokhio !!
This overriding Scene Material thing was already super fun to play.
But as you said, it overrided all materials, and also connecting same scene to multiple Rootscene doesn’t seem to work, so couldn’t duplicate same scene to apply different material (maybe creating a sub patch and copiying that would work?? haven’t tried.)

For thing like XR project this technique of taking only the shadow pass would definitely be a great thing. Since I’m gonna need it for the project I"m working on now , will give a try on the legacy technique, where you’ll create 2nd camera looking from the top, and rendering that texture as shadow texture, so then I wouldn’t need a floor.

Yea I did a test in c# with custom material properties node but it didn’t worked out of the box, for some reason. Whether I’m calling it incorrectly inside gamma, or shader compiler don’t see other shaders already compiled in stride. Since there is no errors bit not obvious what is wrong. I’ll put code on github latter today, and try to ask dev’s to take a look…