Forum

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…