lightmaps, I make a texture out of what is projected on the static geomtry
i think you should read a paper on shadowmaps and one on stencilshadows...
the beauty of shadowmaps is that they are easy to do, since you _don't_ have to extrude any geometry at all, only render the scene from another view
the beauty of stencil shadows is that you _don't_ have to mess with multitexturing and tricky texturecoordinates, you only extrude geometry, and render a huge quad with the shadowcolor over the whole scene...
forget about it i found a site with tutorials on directional,point,and spot(all per-pixel) still looking for one on ambient.
In the world of computer shadows, shadow volumes are high level only problem is that they are hard shadows unless you do a cluster but thats no good. I'm hoping to use the shadow volume way of doing shadows to create a soft shadow map or a cluster of shadow volumes during a compile stage and a soft shadow map texture for realtime rendering. Is this possible?
if your result are going to be used in a shadowmap texture anyways, I would go with the shadowmap technique all the way…putting shadow values into the stencil buffer cost you a rendering of the object(+extrusion) for every part of the cluster(as well as a quad for shadow color)…a shadowmap is also one rendering, but without extrusion and all that, same thing can be done there, rendering from multiple views and creating a soft cluster(and you can do pixelshader postprocesses like blur on the map right away)…
also, I don't understand how you are going to get the stencilshadow into a shadowmap?
I need help with my code i wrote for jme. I used the depth fail method because of camera reasons and because if I'm extruding existing geometry it's already capped. I didn't didn't create extra vertex's I just wanted to see it work regardless oh how it looks. Right now it draw just a black screen. I went over the code word for word 3 times and don't see what is wrong so I'll probably never see it. On to jme-jogl only have to convert render texture and I guess input since nobody else offered to help.
}
//init disables color and z buffer writing
private void shadowInit()
{
GL11.glColorMask(false,false,false,false);
GL11.glDepthMask(false);
}
//passOne sets stencil to 0 and increases on Z fail of back faces
private void passOne()
{
ss = display.getRenderer().createStencilState();
cs =display.getRenderer().createCullState();
ss.setStencilFunc(ss.SF_ALWAYS);
ss.setStencilRef(0);
ss.setStencilMask(~0);
ss.setStencilOpFail(ss.SO_KEEP);
ss.setStencilOpZPass(ss.SO_KEEP);
ss.setStencilOpZFail(ss.SO_INCR);
cs.setCullMode(cs.CS_FRONT);
ss.setEnabled(true);
cs.setEnabled(true);
rootNode.setRenderState(ss);
rootNode.setRenderState(cs);
}
//passTwo decreases on ZFail of front faces
public void passTwo()
{
cs =display.getRenderer().createCullState();
ss = display.getRenderer().createStencilState();
ss.setStencilOpFail(ss.SO_KEEP);
ss.setStencilOpZPass(ss.SO_KEEP);
ss.setStencilOpZFail(ss.SO_DECR);
cs.setCullMode(cs.CS_BACK);
ss.setEnabled(true);
cs.setEnabled(true);
rootNode.setRenderState(ss);
rootNode.setRenderState(cs);
}
//shader the extrudes back faces and takes care of lighting
public void drawShadowVolume()
{
URL vertProg = test.class.getClassLoader().getResource("vp0.vert");
URL fragProg = test.class.getClassLoader().getResource("fp0.frag");
so = display.getRenderer().createGLSLShaderObjectsState();
if (!so.isSupported()) {display.close();System.exit(0);}
so.load(vertProg,fragProg);
rootNode.setRenderState(so);
}
//updates only where stencil value is 0
public void finalPass()
{
zs=display.getRenderer().createZBufferState();
ss = display.getRenderer().createStencilState();
zs.setFunction(zs.CF_EQUAL);
ss.setStencilFunc(ss.SF_EQUAL);
ss.setStencilMask(~0);
ss.setStencilRef(0);
ss.setStencilOpFail(ss.SO_KEEP);
ss.setStencilOpZPass(ss.SO_KEEP);
ss.setStencilOpZFail(ss.SO_KEEP);
ss.setEnabled(true);
cs.setEnabled(true);
rootNode.setRenderState(zs);
rootNode.setRenderState(ss);
let down again by forum support for anybody that digs this up if you dig this up I got a weird problem it might help you first the picture
it made the model transparent and you can’t tell but I am getting 500 fps I don’t know if this really counts it is doing all the calculations per frame just not displaying showing a shadow at all and can put anything in for kight.ms3d i got it from the nvidia infinate shadow volume thingy.
the code only changes being in final pass i made the Z buffer state update on greater or equal to and disabled all the states after final render. You also might notice I use bits of lwjgl code here and there and that is just for ease and I don’t know the jme equivalent. Also I didn’t split outlining verts 1 because i couldn’t get the leaf node of the model
}
//init disables color and z buffer writing
private void shadowInit()
{
zs=display.getRenderer().createZBufferState();
GL11.glColorMask(true,true,true,true);
zs.setWritable(true);
zs.setEnabled(true);
rootNode.setRenderState(zs);
}
//passOne sets stencil to 0 and increases on Z fail of back faces
private void passOne()
{
ss = display.getRenderer().createStencilState();
cs =display.getRenderer().createCullState();
ss.setStencilFunc(ss.SF_ALWAYS);
ss.setStencilRef(0);
ss.setStencilMask(~0);
ss.setStencilOpFail(ss.SO_KEEP);
ss.setStencilOpZPass(ss.SO_KEEP);
ss.setStencilOpZFail(ss.SO_INCR);
cs.setCullMode(cs.CS_FRONT);
ss.setEnabled(true);
cs.setEnabled(true);
rootNode.setRenderState(ss);
rootNode.setRenderState(cs);
}
//passTwo decreases on ZFail of front faces
public void passTwo()
{
cs = display.getRenderer().createCullState();
ss = display.getRenderer().createStencilState();
rootNode.setRenderState(ss);
rootNode.setRenderState(cs);
rootNode.setRenderState(so);
}
//shader the extrudes back faces and takes care of lighting
public void drawShadowVolume()
{
URL vertProg = test.class.getClassLoader().getResource("vp0.vert");
URL fragProg = test.class.getClassLoader().getResource("fp0.frag");
so = display.getRenderer().createGLSLShaderObjectsState();
if (!so.isSupported()) {display.close();System.exit(0);}
so.load(vertProg,fragProg);
rootNode.setRenderState(so);
}
//updates only where stencil value is 0
public void finalPass()
{
zs=display.getRenderer().createZBufferState();
ss = display.getRenderer().createStencilState();
zs.setFunction(zs.CF_LEQUAL);
ss.setStencilFunc(ss.SF_GEQUAL);
ss.setStencilMask(~0);
ss.setStencilRef(0);
ss.setStencilOpFail(ss.SO_KEEP);
ss.setStencilOpZPass(ss.SO_KEEP);
ss.setStencilOpZFail(ss.SO_KEEP);
ss.setEnabled(true);
zs.setEnabled(true);
rootNode.setRenderState(zs);
rootNode.setRenderState(ss);
If you post huge amounts of code then tell people to debug it for you, don't expect to get a whole lot of help, no matter what forum you are on. Quickest way to help is to ask succinct questions about a specific problem.
sorry there really isn't any question for me to ask I looked at like 20 algorithums and followed them all to the point. Guess it's just a failed project