Have a dynamic mesh cast shadows on itself?

Hey guys,

sorry if this is a noob question and if this post gets a bit lengthy. I am new to learning VVVV, this is my first “real” project and this is the first point where I got stuck.

The project I wanna do is the typical “augmented sandbox”. Kinect from above, projecting the correct depth-map on the terrain. And what can I say: its working!

Now I have this Idea in my head I really wanna do. Have the mountains cast “virtual shadows” on the terrain and being able to move this virtual light source.

My process:
I created the terrain by using a grid, then sample the kinect depth map via pipet node and use its luma-values as (mapped) z-coordinates for the mesh vertices. Works great.

Bot if I experiment in rendering the mesh with phong-directional or something, I get this very odd, “unshaded” effect and no shadows on itself. Only the outline.

How can I place a lightsource so the mesh casts shadows on itself? (I would then create a top-down-view and blend it with the actual image-output to overlay the shadows onto the terrain).

Thanks so much for reading and maybe helping! VVVV is quite overwhelming but these forums are really great!

1 Like

Welcome Evlmnkey,

if I understood you right,you can try this contrib:

https://vvvv.org/contribution/deferred-shadow-dx11

Hey Evlmnkey,

Check this contrib: superphysical

I would like to attach the current WIP-patch, but the forum doesn’t let me because new user, apparently , so here is a screenshot.

Hi, this is typical problem you get when you do that, that way. The problem here, is that vertices moved away from surface, but normals aren’t re calculated so no ligtning…
Your options:

  • calculate normals from kinect texture (i think i should be around on forums somwhere) use at as normals on your phong shader

  • make you displacement as gsfx, and use caluclate normals gsfx (note it would give you flat normals)

  • do everything in deffered (render to channels position, depth color then do the lightning texture based) there is DepthReconstruction you can use to get normals againts view…

Hey guys, so I had some time and found a pretty simple solution.

I recalculate the normals with the “normals” node and then use the SoftShadows Contrib to place a lightsource. (I added the patch and the depth-texture I use for now in this post if anyone wants to run it).

Now my problem, I highlighted it in the screenshot. I want the mountains to cast long shadows on the rest of the mesh (think Mt. Fuji) , so the highlighted area shouldn’t be there. How can I realize this?

I am sorry for the open question. I know its good practice to find out as much on my own, I really tried. Thanks in advance.

nodebased_normalcalc.v4p (152.6 KB)

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.