lighting mode and ambient light

Started by raft, September 24, 2010, 08:39:55 PM

Previous topic - Next topic

raft

i need to set ambient light to a high value to make details of textures visible. but in that case i cant properly set color of glow planes. -i guess- because of over lighting they seem white. and seems as calling

Object3D.setLighting(Object3D.LIGHTING_NO_LIGHTS);

has no effect with ambient light. so what can i do in this case except changing ambient light ?

raft

some images will make things clearer:

this is how it looks at the moment. i want this glow look green (via setting additional color). transparency mode is additive and ambient light is kind of high:


same ambient light but with transparent mode default. looks kind of green but we lost brightness because of default transparency mode.


low ambient light and transparency mode default. definetely looks green but no brightness and textures don't look good.

paulscode

What color and shade is the original png image, and what shade are you using for the additional color?  I would try starting with a darker green png image for the texture and using a darker green for the additional color as well to see if you can get it down to the total brightness and color you are looking for.

raft

i'm using a white image. indeed it's your glow image converted to white. additional color is green. even with a very dark image like below, the glow seems white with transparency mode add and high ambient color ???



glow with image above.

paulscode

The reason for this problem, of course, is that with additive color you are adding the color of the transparent image to the existing color, so even a dark color causes the area to approach white very quickly when the color you are adding it to is already bright to begin with.  Another thing you could try is two layers for your glow effect.  The first you would use normal transparency mode to shade the area closer to the target color.  Then placing the texture with additive transparency over that won't require as much additional color to reach your target color, so hopefully it won't end up looking as bright/white.

raft

i see, thanks. but that two layers of glow will have its own difficulties. they cant be just simple billboarded quats. i need to place them according to camera each frame such that one is behind other all the time. not too difficult but not that simple too.

paulscode

#6
One billboard quad could be the child of a second billboard quad, both with the same center/pivot.  The polys of the outer layer would consist of vertices with lower values for z (or higher, depending on which side billboarding points toward the camera in jPCT) than those of the inner layer.  Then you would give the parent object normal transparency and the child object additive transparency.

--EDIT--
I should point out in case you haven't noticed already, jPCT automatically calculates the center/pivot of a quad to have the same z-value as the polys when the object is built.  One work-around to "trick" jPCT into using a different center is to add two additional back-faced polys (on the other side of the imaginary "cube").  In my above scenario you could leave the parent object as 2 polys and just add a the extra polys to the child object.  An alternative to adding polys is with translateMesh, I believe, however as I recall it will just revert back if you call build or buildAll afterwards.

raft

yeap, i suppose parent child relation will greatly ease calculation. or i guess alternatively a simple object with two parellel quads will also do the job.

i couldnt get your idea to trick jPCT ??? isnt setRotationPivot method enough to set rotation pivot ?

i wish this has an easier solution with color settings ::)

paulscode

#8
Right, but jPCT doesn't use the rotation pivot for the billboard effect.  Instead, it uses the object's center-of-mass, which is apparently calculated when the object is built.  This can be changed either by making the object have more volume by adding polys or by translating the mesh after building.

For the color settings, you would need to somehow specify negative values for the additive transparency mode - you want to add some green after subtracting a bit of red and blue, so the resulting effect is brighter than the initial colors, but not in a way that makes it look white.  I'm not sure if there is a one-step way to do that.

raft

thanks paul ;D i wasn't aware of that. as you suggested, i've played with color of glow plane and results looks better now.