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.


Topics - Klaudiusz

Pages: [1] 2
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:
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();
}
}

2
Support / projective/shadows on UV+ENV objects
« on: 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?

3
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?


4
Bugs / Wrong normals rotations when object has a parent which is scaled
« on: October 11, 2007, 11:11:29 pm »
Hi Egon,

Please take a look on attached example, it shows how normals are modified when object has a parent and this parent is scaled.

Code: [Select]
import java.awt.Color;

import com.threed.jpct.*;

public class TestSize {

public static void main(String[] args) {
World w = new World();
FrameBuffer fb = new FrameBuffer(800, 600, FrameBuffer.SAMPLINGMODE_GL_AA_2X);
fb.disableRenderer(IRenderer.RENDERER_SOFTWARE);
fb.enableRenderer(IRenderer.RENDERER_OPENGL);
Object3D Toy= Primitives.getCube(17);


TextureManager tm = TextureManager.getInstance();
Texture vt = new Texture("blue067.jpg");

tm.addTexture("uv", vt);


TextureInfo ti=new TextureInfo(tm.getTextureID("uv"));

Toy.setTexture(ti);
Toy.setEnvmapped(Object3D.ENVMAP_ENABLED);


Object3D Toy2=Toy.cloneObject();
Toy2.translate(50, 0, 0);
Toy.addChild(Toy2);


w.getCamera().moveCamera(Camera.CAMERA_MOVEOUT, 200);
w.getCamera().moveCamera(Camera.CAMERA_MOVEUP, 50);
w.setAmbientLight(250, 250, 250);
Toy.build();
w.addObject(Toy);
Toy2.build();
w.addObject(Toy2);


while(!org.lwjgl.opengl.Display.isCloseRequested()) {

fb.clear(Color.DARK_GRAY);
w.renderScene(fb);
w.draw(fb);
fb.update();
fb.displayGLOnly();
Toy.scale(1.001f);
Toy.rotateX(0.005f);
w.getCamera().lookAt(Toy2.getTransformedCenter());

try {
Thread.sleep(10);
} catch(Exception e) {}

}
fb.dispose();

}

}

5
Support / Question regarding the 3DS loading process
« on: September 28, 2007, 03:28:10 pm »
Hi,

While the 3DS file is loaded, some materials and textures are created:

Quote
File head2.3DS loaded...79376 bytes
Processing new material Material #25!
Texture named AFRICAN_.JPG added to TextureManager!
Processing new material Material #26!
Processing new material Material #27!
Processing new material Material #28!
Texture named EYE_DARK.TIF added to TextureManager!
Processing new material Material #29!
Processing new material Material #30!
Processing new material Material #31!
Processing new material Material #32!
Processing new material Material #33!
Processing new material Material #34!
Processing object from 3DS-file: head2
Object 'head2_jPCT0' created using 2880 polygons and 1487 vertices.

I suppose those textures are created as dummy.

How can i remove this creating? (I havy my own texture loader and i'm affraid whether the name of some new texture can be taken by some of the dummies)
What it's "new material Material #**" ? What's that mean in JPCT?

Thank You

6
Bugs / Bilboarding when object has parent
« on: September 27, 2007, 11:28:59 am »
Hello,

Billboarding doesn't work when object has a parent. In documentation is written that object is always faced to the camera.

7
Support / How to set color values in Mesh?
« on: September 26, 2007, 12:04:50 am »
Hi,

I'm thinking about something like my own Global Illumination effect, where each point from the Mesh could be classified as little light. Than i could calculate the illumination between all points in the world and add the value to each of them.

Does the current funtionallity od JPCT makes it possible? Can i handly modify the color of each point in Mesh?

Thanks in advice!

8
Support / How can i read some point position from Mesh?
« on: September 23, 2007, 07:20:52 pm »
Hi,

I want to read point position from the Mesh. I used VertexController:

Code: [Select]
private class getPointPosition extends GenericVertexController {
 
     int PointNr;
     
     getPointPosition(int Nr) {
       PointNr=Nr;
     }

     public void apply() {
       SimpleVector[] srcMesh=this.getSourceMesh();
       System.out.println(srcMesh[PointNr]);
       }

}

I works, i mean it read the SimpleVector, but i want to return srcMesh[PointNr]. Unfortunatelly apply() can't return anything.

Is there some other way to do this?

9
Bugs / Clearing FrameBuffer when setRenderTarget is used
« on: August 29, 2007, 03:47:48 pm »
Hi Egon,

FrameBuffer.clear() method clears the whole FrameBuffer no matter how small texture is used in setRenderTarget.

Little step in the optimalisation process:)

10
Support / How to do this: Cartoon rendering effect
« on: August 23, 2007, 09:55:55 pm »
Hi,

I would like to show You how to do some easy and nice trick like cartoon rendering.

What is cartoon rendering? It's a rendering with black outlines on the edges:




How to do this?

All what we have to do is:

1) Clone the source object
2) Scale a littlebit the cloned object
3) Move the clone a littlebit away of the camera
4) Colorise the cloned object to be black.

That's all. Since now cloned object should be like a shadow. Shoud be translated and rotated together with source object and always should be a littlebit away of the camera.

The executable file and complete source code could be find there:
http://www.jpct.net/others/cartoon.zip


That's all! Hope You like it. Enjoy!

Thanks Egon for the support.


11
Support / setRenderTarget() method in OpenGL mode for every frame
« on: August 07, 2007, 09:56:16 am »
Hi,

I would like to use mirrored env on the object. Could i ask You for little guide how to do it fast in hardware mode? There is not too much informations on the forum.

Is the frame rendered directly to the texture in OpenGL mode? Or the data it is copied/modified?

Could you provide some simple source code?

Thanks

12
Bugs / Bad lighting when object has more than one texture
« on: July 29, 2007, 09:24:36 pm »
Hi,


Lights works only on one texture, not on all when object has more of them.

For example, when i use UV texture as first one and  ENV texture as second, only ENV is lighten.

see attached screenshots:

1. Two the same objects. One with UV+ENV and secound with UV only, very neer of the light source (light position is camera position)




2. The same situation but both objects are far away of the light. UV texture of the first object has been not changed, ENV texture disapeard. Secound object is black (too far of the light).



The effect is bad because objects placed away of the light source are still bright.

13
Support / cloneObject() and setRotationPivot - what's wrong?
« on: June 29, 2007, 09:17:44 pm »
Hi,

I have the source object and i just use cloneObject(). Everything is OK until i use simply setRotationPivot(new SimpleVector(0, 0, 0)) for each of them. The source object is modified OK, but there is no difference in cloned object behaviour. Should i use some additional method for clone the object?

Thank You in advice.

14
Bugs / cloneObject() and TRANSPARENCY_MODE_ADD
« on: June 28, 2007, 09:30:49 pm »
It's a detail, but You should know it.

if source object has TRANSPARENCY_MODE_ADD (added in last jpct version), cloneObject doesn't copy this. It's copies transparency but sets TRANSPARENCY_MODE_DEFAULT.

15
Bugs / TextureInfo.MODE_REPLACE don't work
« on: June 27, 2007, 12:35:45 am »
Hi,

When i use UV+Env both textures with TextureInfo.MODE_REPLACE ... its showed UV Texture only. I think this mode does nothing.

Pages: [1] 2