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

Topics - Klaudiusz

#1
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();
}
}
#2
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?
#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
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.

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
September 28, 2007, 03:28:10 PM
Hi,

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

QuoteFile 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
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?
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?
September 23, 2007, 07:20:52 PM
Hi,

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

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
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
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
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
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
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
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
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.
#16
Support / AdditionalColor directly from Loader?
June 16, 2007, 07:30:39 PM
Hi,

Can loader read the color information for every part of object3d (i mean 3ds file)?
I know it is possible to set it by hand,but maybe there is a way to set it automatically? It could be usefull, sometimes only color+gouraund shading is enought for me.
#17
Support / Blur as PostProcessor
June 05, 2007, 09:58:37 AM
Hello,

It's possible to add normal blur/gaussian blur as post processor in further version? I know Bloom has been released but it's not the same.

#18
Hello,

Well... I have a table:

Quotefloat Coordinates[] = {
     XPos,YPos,ZPos,XAxis,YAxis,ZAxis,
     ...
     ...};    // * TotalFrameLenght

Later i use the table:

Quotefloat XPos = Coordinaties[CurrentFrame*6];
float YPos = Coordinaties[CurrentFrame*6+1];
float ZPos = Coordinaties[CurrentFrame*6+2];
float XAxis = Coordinaties[CurrentFrame*6+3];
float YAxis = Coordinaties[CurrentFrame*6+4];
float ZAxis = Coordinaties[CurrentFrame*6+5];

And finnaly i want to set it.

And here is my problem. For camera i have this problem solved:
Quotecamera.setPosition = (XPos,YPos,ZPos);
But i don't know how i can set the Axis.

So this is my question:

How i can set camera axis and how i can set posision and axis for each object, independly of previous position/rotation?

Thanks in advice.

Egon, maybe you could add setPosision and something like setAxis also for Object3d in further version? It would be great for me :)
#19
Support / mp3 player for JPCT?
May 10, 2007, 10:37:10 PM
Hello!

I would like to play mp3 on the background while rendering.

Can You recomeded me some opensource routine?

Should be compatibile with java 1.1 as JPCT.

Maybe somebody have some experience in this case?

Thank You in advice

Klaudiusz
#20
Hello

First of all, thank You for JPCT - that's great tool. I've just discovering it...

I know JPCT is designed for making games, but i would like to use it to make simple presentation - realtime animation (scene) rendering.

I found here many usefull thinks, but i have two propositions, maybe You could implement it in further versions?

1. Camera Zoom - it should be very easy (just add this value to Z after ratation).

2. Moving and rotating in space (objects and camera), based on time Keyframes similar as You made keyframes for object animation. I recommend .lws (lightwave scene) fileformat - it is clear and easy txt based key frame system. Key Frame is usefull also for Camera Zoom...

That's just my proposisions, i don't know what You think about it:)

Thank You and Best Regards.
Klaudiusz