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 - Wojtek

#1
Support / Re: Active lights in GLSLShader
August 24, 2011, 10:29:45 PM
Hello,

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

Thanks,
Wojtek
#2
Projects / Re: ObjectsEditor
August 24, 2011, 12:17:07 AM
I have uploaded newer version of ObjectsEditor (link is the same): http://www.wojtech.virthost.pl/oe/ObjectsEditor.zip

Changes:
- 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
#3
Support / Re: Active lights in GLSLShader
August 23, 2011, 11:03:54 PM
Yes it would be helpful, because I will pass that value to shader.
#4
Support / Re: Active lights in GLSLShader
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.
#5
Support / Re: Usage of shared GLSLShader
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:

public void apply(final Object3D obj)
{
final GLSLShader su = getShader();

IRenderHook hook = new IRenderHook()
{
@Override
public boolean repeatRendering()
{
return su.repeatRendering();
}

@Override
public void onDispose()
{
su.onDispose();
}

@Override
public void clear()
{
su.clear();
}

@Override
public void beforeRendering(int arg)
{
su.setUniform(...);
su.beforeRendering(arg);
}

@Override
public void afterRendering(int arg)
{
su.afterRendering(arg);
}
};
obj.setRenderHook(hook);
}


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

Egon,
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.

Thanks,
Wojtek
#6
Support / Active lights in GLSLShader
August 23, 2011, 08:57:29 PM
Hello,

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?

Thanks,
Wojtek
#7
It is much better :)

Thanks,
Wojtek
#8
Hello,

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: http://www.wojtech.virthost.pl/oe/oe_envmap.zip and run it using run.bat or run.sh
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

Thanks,
Wojtek

PS. One additional update: Calling setEnvmapped() has also no effect on compiled object.
#9
Support / Usage of shared GLSLShader
August 20, 2011, 10:39:26 PM
Hello,

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,
Wojtek
#10
Projects / Re: ObjectsEditor
August 10, 2011, 06:59:40 PM
Sure please do :)
#11
Projects / ObjectsEditor
August 09, 2011, 11:51:57 PM
Hello,

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: http://www.wojtech.virthost.pl/oe/ObjectsEditor.zip


Thanks,
Wojtek
#12
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.

Thanks,
Wojtek
#13
Support / Hardware only mode optimizations hints
May 08, 2010, 03:11:58 PM
Hello,

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?

Thanks,
Wojtek
#14
News / Re: New version of...myself!
May 06, 2010, 04:42:01 PM
Congratulations :)
#15
Support / Re: Compiled dynamic objects
April 22, 2010, 09:18:48 PM
Works good for me.

Thanks!
Wojtek