1
Bugs / Shadows: differend behaviour between gfx cards, culling problem
« on: October 25, 2007, 08:11:54 pm »
Hi Egon, I hope You're not tired couse of my problems?
I've noticed differend behaviour between two graphics cards which i use.
I have Intel card:
and also ATI:
My problem is that i need to disable or enable culling (depending of the graphics card), if i want to have desired shadow effect:
1. Intel, culling enabled:
It's good. Shadow is visible on objects.
2. Intel,culling disabled:
Looks very bad, this is not what i want.
3. ATI, culling enabled:
No shadow on the objects!
4. ATI, culling disabled:
Looks nice! This is it!
On Intel everything is nice when culling is enabled, but on ATI i need to disable culling and lowes the performance.... I think it's not good when behaviour is so differend.
I used this code:
I've noticed differend behaviour between two graphics cards which i use.
I have Intel card:
Code: [Select]
Driver is: idisw2km/2.50.4136.2000 on Intel / Intel 915G
FBO not supported or disabled!
OpenGL renderer initialized (using 4 texture stages)
and also ATI:
Code: [Select]
Driver is: ati2dvag/6.14.10.6715 on ATI Technologies Inc. / Radeon X300/X550/X1050 Series x86/MMX/3DNow!/SSE2
FBO supported and used!
OpenGL renderer initialized (using 4 texture stages)
My problem is that i need to disable or enable culling (depending of the graphics card), if i want to have desired shadow effect:
1. Intel, culling enabled:
It's good. Shadow is visible on objects.
2. Intel,culling disabled:
Looks very bad, this is not what i want.
3. ATI, culling enabled:
No shadow on the objects!
4. ATI, culling disabled:
Looks nice! This is it!
On Intel everything is nice when culling is enabled, but on ATI i need to disable culling and lowes the performance.... I think it's not good when behaviour is so differend.
I used this code:
Code: [Select]
import java.awt.*;
import com.threed.jpct.*;
import com.threed.jpct.util.*;
public class TestShadow2{
private FrameBuffer fb = null;
private World world = null;
private Object3D plane = null;
private Object3D cube = null;
private Object3D sphere = null;
private Projector projector=null;
private ShadowHelper sh = null;
private Light sun=null;
public TestShadow2() {
Config.glColorDepth = 24;
Config.glFullscreen = false;
Config.farPlane = 1000;
Config.glShadowZBias = 0.5f;
Config.glTrilinear=false;
}
private void initStuff() throws Exception {
fb = new FrameBuffer(800, 600, FrameBuffer.SAMPLINGMODE_NORMAL);
world = new World();
fb.enableRenderer(IRenderer.RENDERER_OPENGL, IRenderer.MODE_OPENGL);
fb.disableRenderer(IRenderer.RENDERER_SOFTWARE);
plane = Primitives.getPlane(20, 30);
plane.rotateX((float) Math.PI / 2f);
cube=Primitives.getCube(25);
cube.setAdditionalColor(Color.RED);
cube.translate(0, -30, -0);
cube.setCulling(Object3D.CULLING_DISABLED);
sphere=Primitives.getSphere(17);
sphere.translate(40, -20, -50);
sphere.setAdditionalColor(new Color(0,0,50));
sphere.setCulling(Object3D.CULLING_DISABLED);
world.addObject(sphere);
world.addObject(plane);
world.addObject(cube);
TextureManager tm = TextureManager.getInstance();
projector = new Projector();
sh = new ShadowHelper(world, fb, projector, 1024);
sh.addCaster(cube);
sh.addCaster(sphere);
sh.addReceiver(cube);
sh.addReceiver(plane);
sh.addReceiver(sphere);
sh.setAmbientLight(new Color(0,0,0));
sh.setFiltering(false);
world.setAmbientLight(90,90,90);
world.buildAllObjects();
sun=new Light(world);
sun.setIntensity(50, 50, 50);
}
private void doIt() throws Exception {
Camera cam = world.getCamera();
cam.moveCamera(Camera.CAMERA_MOVEOUT, 150);
cam.moveCamera(Camera.CAMERA_MOVEUP, 100);
cam.lookAt(plane.getTransformedCenter());
projector.setFOV(0.5f);
projector.setYFOV(0.5f);
SimpleVector pos=cube.getTransformedCenter();
projector.setPosition(pos);
projector.moveCamera(Camera.CAMERA_MOVEUP, 200);
projector.lookAt(pos);
SimpleVector offset=new SimpleVector(1,0,-1).normalize();
projector.moveCamera(offset, 215);
offset.rotateY(0.7f);
while (!org.lwjgl.opengl.Display.isCloseRequested()) {
projector.lookAt(cube.getTransformedCenter());
//offset.rotateY(0.007f);
projector.setPosition(pos);
projector.moveCamera(new SimpleVector(0,-1,0), 200);
projector.moveCamera(offset, 215);
sun.setPosition(projector.getPosition());
sh.updateShadowMap();
fb.clear();
sh.drawScene();
fb.update();
fb.displayGLOnly();
Thread.sleep(10);
}
fb.disableRenderer(IRenderer.RENDERER_OPENGL);
fb.dispose();
System.exit(0);
}
public static void main(String[] args) throws Exception {
TestShadow2 cd = new TestShadow2();
cd.initStuff();
cd.doIt();
}
}