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.

Messages - Wojtek

Pages: [1] 2 3 ... 5
Support / Re: Active lights in GLSLShader
« on: August 24, 2011, 10:29:45 pm »

I have checked it today and it is good very well.


Projects / Re: ObjectsEditor
« on: August 24, 2011, 12:17:07 am »
I have uploaded newer version of ObjectsEditor (link is the same):

- improved standard shader performance
- added glow shader
- added possibility to select texture blending mode
- added Compiled flag that allows to compile/decompile object
- added culling flag

Support / Re: Active lights in GLSLShader
« on: August 23, 2011, 11:03:54 pm »
Yes it would be helpful, because I will pass that value to shader.

Support / Re: Active lights in GLSLShader
« on: August 23, 2011, 10:16:16 pm »
Well that uniform is more about the maximum number of lights supported by shader. I am more interested in actual number not maximum.

Support / Re: Usage of shared GLSLShader
« on: August 23, 2011, 09:12:10 pm »
I think I have managed that problem.
Basically what I am doing is to:
* create one GLSLShader instance so vertex/fragment shaders code is compiled once
* create one instance of proxy IRenderHook anonymous class per Object3D and delegates all calls to my one GLSLShader plus add additional setUniform() calls to beforeRendering() method.

The code looks more or less like that:
Code: [Select]
public void apply(final Object3D obj)
final GLSLShader su = getShader();

IRenderHook hook = new IRenderHook()
public boolean repeatRendering()
return su.repeatRendering();

public void onDispose()

public void clear()

public void beforeRendering(int arg)

public void afterRendering(int arg)

The only thing I am wondering is when the clear() / onDispose() methods are called and if multiple calls of them will be not harming...

If you think that this code is safe and usefull, perhaps it will be a good ideat to add it to JPCT?
As I understand the purpose of uniform values in GLSL shaders is to allow sharing the same shader between different objects.


Support / Active lights in GLSLShader
« on: August 23, 2011, 08:57:29 pm »

Is it possible to determine how many lights are assigned to particular Object3D?

What I want is to determine active lights count in my Fragment shader to not iterate through 8 lights.
There is an additional reason why I want to do that.
If I had previously specified 5 lights and disabled 3 of them, my shader is still getting values of old 3 lights.

Is there any specific method in JPCT to determine actual number of active lights associated to world, or is GLSLShader passing any uniform value which I would be able to use in my shader?


It is much better :)



I have found problem with envmap textures on compiled objects.
Basically if object is compiled it is not possible to change envmap texture using PolygonManager.setPolygonTexture() method.

Steps to recreate:
1. set Config.glForceEnvMapToSecondStage = true;
2. create sphere using Primitives class
3. call calcTextureWrapSpherical(), build(), setEnvmapped(true)
4. assign two textures (some texture and envmap one)
5. call compile()
6. try to change textures to different ones

Expected results:
Both textures are changed and displayed correctly

Actual results:
Only first texture has been changed. It is not possible to change envmapped texture. If shared is used, it also does not get new texture

Optional steps using ObjectsEditor:
1. Download editor from: and run it using run.bat or
2. Create sphere from primitives
3. select expo_bamboo.png as Texture1 and set it's TextureMode to Multiply
4. select _env.png as EnvmapTexture and set it's TextureMode to Add [Both textures are visible]
5. change EnvmapTexture to _env2.png [Texture has been updated]
6. click Compiled checkbox [Object has been compiled correctly, textures are working ok]
7. change Texture1 and EnvmapTexture to other values

Actual result:
Texture1 has been changed
EnvmapTexture has not been changed


PS. One additional update: Calling setEnvmapped() has also no effect on compiled object.

Support / Usage of shared GLSLShader
« on: August 20, 2011, 10:39:26 pm »

I am wondering how to use one instance of GLSLShader with multiple objects.

I am pointing to the situation when my shader is using additional uniform value, and each object where shader will be applied have different value for that uniform.

What I read in docs:
* I can call setUniform() to pass value during runtime
* I can call Object3D.setRenderHook() to assign shader to object.
* I can overwrite beforeRendering() method to pass my uniforms

My question is how to detect which obejct3d my shared is currently rendering?

Thanks for help,

Projects / Re: ObjectsEditor
« on: August 10, 2011, 06:59:40 pm »
Sure please do :)

Projects / ObjectsEditor
« on: August 09, 2011, 11:51:57 pm »

Recently I was playing a little bit with JPCT and decided to create a visual editor to see how properties change are affecting rendered object.

As editor is quite helpful for me I thought it may be also helpful to other people.
Currently it does not have rich functionalities yet, however it allows to:
* modify environment properties like ambient light, background etc
* add multiple lights to the environment
* add multiple primitive elements (from Primitives class) to scene
* add rectangular billboard objects to scene
* import 3ds objects and add them to scene
* save/load environment properties
* save/load composed object
* define basic object properties (textures, color, lighting, geometry, shader etc)

Editor always works on compiled objects, so I have not added any properties that cannot be applied to compiled object.

Regarding to current limitations:
* it is not possible to save object in format that could be used later to import it in other application - currently it is only possible to watch effect and replay it by applying the same changes in other application
* I have problem with removing textures from Object3D - I have not found any method in JPCT to reset object texture information
* I do not know how to reset texture information in shader, so if one object has 2 textures assigned and the second one has only one, then second object will be also rendered with 2 textures
* I am not sure how to manage properly resize of GLCanvas. When window is resized, then framebuffer and canvas are recreated and all present objects are disappearing...
* Shaders are not linking properly on some machines
* GUI is very very simple.....

Ok, and there are some screenshots:

If anybody is interested, here is link to compressed program:


Support / Re: Hardware only mode optimizations hints
« on: May 10, 2010, 08:09:26 pm »
Thanks for hints :)

From my side I can add also that it is possible to use tiled textures by multiplicating each UV point by some value (number of tiles that should be used). That way a small texture would be multiplicated and object would look better.


Support / Hardware only mode optimizations hints
« on: May 08, 2010, 03:11:58 pm »

I am wondering if there are any settings that can be applied to decrease memory usage and/or increase performance if application uses only hardware rendering mode.

For example there is a Config.maxPolysVisible setting that I had to set to a big value to be able to display my scenes. I have noticed (please correct me if I am wrong) that when I started using compiled objects, this setting could be set to a much lower value and still the scene is displayed correctly.

So my question is if there are any options that could be turned off (or adjusted) if the hardware mode is used:
a) with compiled objects
b) without compiled object
and no software mode compatibility is needed?


News / Re: New version of...myself!
« on: May 06, 2010, 04:42:01 pm »
Congratulations :)

Support / Re: Compiled dynamic objects
« on: April 22, 2010, 09:18:48 pm »
Works good for me.


Pages: [1] 2 3 ... 5