View Single Post
  #1  
Old 04-24-2013, 01:28 PM
whaleeee whaleeee is offline
Member
 
Join Date: Feb 2013
Posts: 5
Setting up render node for shadowing

I'm trying to use a render texture which will be used in a shader to produce shadows from a single directional light. I set up my directional light as follows:

Code:
# Directional Light
dLight = viz.addLight()
dLight.setEuler(0,45,0)
I then used the code from the third post in this thread to set up my render node and render texture and display it on the screen. Then to fix the position of the render node my code looks like this:

Code:
# add render texture
[width,height] = viz.MainWindow.getSize(viz.WINDOW_PIXELS)
depth = viz.addRenderTexture(size=[width,height],format=viz.TEX_DEPTH)

# add render node
rn = viz.addRenderNode(size=[width,height])
rn.setInheritView(False)
rn.setRenderTexture(depth)

# add render point
renderPoint = viz.addGroup()
renderPoint.setPosition(0,5,-5)
renderPoint.setEuler(0,45,0)

# link the render point and render node
renderLink = viz.link(renderPoint,rn)
This seems to work, and I have the depth texture displayed on a texQuad on my screen. I have two questions to start with:

1. The line:
Code:
renderPoint.setPosition(0,5,-5)
is kind of puzzling to me, and in fact I just put it in as a quick fix so that the render node was located somewhere along the light vectors. My question is where exactly should I put the render point? Logically it would be at the source of the light, but since it is a directional light it is infinitely far away.

2. Does anyone have any tutorials or resources on how to do shadowing using a depth texture in Vizard? I've found several tutorials but they all use GLUT and newer versions of OpenGL.

Thanks
Reply With Quote