Main Menu
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - Klaudiusz

#1
Yes, in my scene all objects are casters and recieves, so this is a real problem for me, i know the difference between cards is a big problem. Besides selfshadowing is pretty:) Thank You very much for the explanations.
#2
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:
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:
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:

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();
}
}
#3
Support / Re: projective/shadows on UV+ENV objects
October 25, 2007, 12:14:58 AM
Really? That's really strange....

Maybe i had some oldest jpct.jar in this project....
#4
Support / Re: projective/shadows on UV+ENV objects
October 25, 2007, 12:02:36 AM
It works great with new jPCT! Even transparency problem disapeard! Thank You very very much! :)

It's just perfect with MODE_ADD:)
#5
Support / Re: projective/shadows on UV+ENV objects
October 24, 2007, 11:37:13 PM
That's truth.... MODE_ADD was the reason :-\.... I'm sending the example. Please check the mail.
#6
Support / Re: projective/shadows on UV+ENV objects
October 24, 2007, 09:47:12 PM
OK, i know. No matter what is on 2,3,4... stages. You are calculating the shadow only for first stage. If fist stage has black texture, shadow won't be calculated.

But i still have no idea why is the problem with transparention.
#7
Support / Re: projective/shadows on UV+ENV objects
October 24, 2007, 09:19:02 PM
First of all i corrected my last post, because ofcorse ENV was on first stage and UV on second.

I discovered that there is problem with secoud stage only. For example the same situation as in point 3 of my previous post:

ENV+UV. ENV forced to second stage:



As You see, now only UV map discovered.




And one more thing, because it make's me stupid:

There is something wrong with trasnsparentions. The same situation as above but the object has setTransparency(255)



It's funny, i don't know why one part of shadow dissaperd and second part not:) Maybe You know?
#8
Support / Re: projective/shadows on UV+ENV objects
October 23, 2007, 08:19:37 PM
Sure, i can post the screenshots. Please take a look:

1. UV only: one texture, everything is ok



2. ENV only: one texture, ok



3. ENV(first stage)+UV(second stage) with MODE_ADD, there is no black shadow :(



4. UV texture with black dots, just to show You the texture on the object:




5. The same as in point 3, so ENV+UV(MODE_ADD) + UV white texture with black dots(3th stage)MODE_MODULATE



As You can see the shadow on the object should be black, but it's not. The black fragments of texture on 3th stage with MODE_MODULATE are black, but shadow not....

I've checked it and this is for sure not MODE_BLEND...i don't know why the shadow is not covering the firt texture...  Maybe could You do something with this?


Everywhere the same parameters,the ambients colors:
world=(50,50,50)
shadow=(5,5,5)

#9
Support / Re: projective/shadows on UV+ENV objects
October 22, 2007, 08:14:11 PM
One more question. Shadow, as a next texture stage has as i suppose TextureInfo.MODE_BLEND mixing mode? I think so because only one texture is shadowed. Could You add TextureInfo.MODE_MODULATE? It makes darkness all texture stages.
#10
Support / Re: projective/shadows on UV+ENV objects
October 22, 2007, 12:35:33 PM
Yes, You right. Works fine. Thanks:)
#11
Support / Re: projective/shadows on UV+ENV objects
October 22, 2007, 10:53:55 AM
No, my graphics cart support it, OpenGL renderee has been initialised correctly:

Driver is: idisw2km/2.50.4136.2000 on Intel / Intel 915G
FBO not supported or disabled!
OpenGL renderer initialized (using 4 texture stages)


Seems like first projective texture is forced to second stage... whatever i have on second stage (i've used also Config.glForceEnvMapToSecondStage to check it) it is replaced by projector.

Shadows also works here but also i can't shadow object with env+uv. Shadows has differend behaviour as on ATI. I'll post it later.

#12
Support / projective/shadows on UV+ENV objects
October 22, 2007, 10:11:19 AM
Hi,

I'm using many objects with UV and ENV mapping together (two stages). I want to use also projective textures or self-shadowing, but seems like it's possible to use only with UV or only with ENV... Can i do something with this?
#13
Everything works fine. Thank You!
#14
News / Re: Beta of 1.15 released!
October 16, 2007, 09:44:09 PM
is this possible to make one object as caster and reciever together? I mean something like self shadows.


Could be very usefull when child object could copy the shadows parameters from the parent.
#15
Hi,

As it is in topic. For example object has 500 polygons and i want to show first 50 on first step, 100 on second... 500 on 10th step. Is this possible in JPCT?