Entitycolor question

BlitzMax Forums/MiniB3D Module/Entitycolor question

*(Posted 2009) [#1]
Is there something im doing wrong with entitycolor when I colour to 158, 205, 255 I get white it should be a bluey colour. Coding on a Vista laptop atm :s

Anyone have any idea why this is happening?


Warner(Posted 2009) [#2]
Strange. It should be working. It does work here:
Import sidesign.minib3d

Graphics3D 800, 600, 0, 2

cam = CreateCamera()
MoveEntity cam, 0, 0, -5

cube = CreateCube()
EntityColor cube, 158, 205, 255

Repeat

	RenderWorld
	Flip

Until KeyHit(key_escape)

End

It could have something to do with the way the mesh is built. If a surface is painted with a brush, that overrules EntityColor.
Maybe try this:
brush=CreateBrush(158,205,255)
PaintMesh mesh, brush

or:
surf = GetSurface(mesh, 1)
PaintSurface surf, brush

Or, if the mesh has childs:



ima747(Posted 2009) [#3]
Try running warner's first example. If you can't color a cube made with CreateCube() then it's likely the drivers for your graphics card on your laptop.

If that works then, as warner said, it's something overriding the brush and blocking the color.


ziggy(Posted 2009) [#4]
Be sure not to have a white light very near your mesh


*(Posted 2009) [#5]
yeah that seems to color the cube, the only reason I asked because if I color to 255, 255, 0 I get yellow and 255, 0, 0 I get red but not 158, 205, 255 :s


*(Posted 2009) [#6]
with Warners examples I can colour all variations of 255, 255, 0 or 255, 0, 255 etc but NOT 158, 205, 255 or anything other than 0 or 255 :(


Warner(Posted 2009) [#7]
Sounds like some form of float to integer conversion.


jkrankie(Posted 2009) [#8]
Any textures on your mesh will affect entitycolor. for example if you have a yellow mesh texture, coloring it light blue with entitycolor will make it very dark blue.

Cheers
Charlie


*(Posted 2009) [#9]
no colour whatsoever, its a basic mesh created with addvertex, addtriangle etc. Just it doesnt colour as intended


ima747(Posted 2009) [#10]
what happens if you color 127, 127, 127 or 0,205,0 ?


*(Posted 2009) [#11]
will check and tell ya


*(Posted 2009) [#12]
127,127,127 is White
0,205,0 is Black


ima747(Posted 2009) [#13]
is 127,127,127 white white? or gray white?


*(Posted 2009) [#14]
its 255, 255, 255 white. In other words you cannot tell the difference between 127 and 255 white. All meshes are fullbright so are not affected by lighting as the system is used for text.


Warner(Posted 2009) [#15]
And what if you apply a texture to this mesh with this color, does that work?



*(Posted 2009) [#16]
Thats good shows fine, incedentally if you add a Entityfx Cube, 1 the box is almost white :). The text in EMP is white however which is a bugger :s


ima747(Posted 2009) [#17]
problem with fullbright? what happens if you change light color?


*(Posted 2009) [#18]
it changes, it seems fullbright washes the colour out


jkrankie(Posted 2009) [#19]
i had some problems with entitycolor and entityblend etc. this week actually. Couldn't work out what exactly it was, but as a last resort i replaced the meshes that were causing the problem with new versions of the same mesh (re-exported them to .b3d format). the problem went away after that.

Maybe that'll help?

Cheers
Charlie


ima747(Posted 2009) [#20]
try making your light color 127,127,127 and see if the washout is less bad. have you tried another computer to see if it's your graphics card?


Warner(Posted 2009) [#21]
@Charlie, maybe the normals were not right?
To obtain the fullbright FX, the ambientlight is set to white. That could have something to do with it as well. Just look through TMesh.bmx, and search for "full bright". There is a remark "todo: disable all lights?". Maybe that is the cause of this?


jkrankie(Posted 2009) [#22]
@Warner, I think the normals were ok, just for some reason the model export was faulty in some way? I've sorted it now, but it was a weird one.

Cheers
Charlie


Chroma(Posted 2009) [#23]
Edzup I'm having the same problem. In Blitz3D I create a plane and do entitycolor on it and it goes bright white.


*(Posted 2009) [#24]
hmm maybe I will sort it but its a pain


Warner(Posted 2009) [#25]
Today I noticed that my AlphaBlending problem (models didn't use any alpha) was due to the light model. I changed it, and the problem went away.
Maybe it can help you as well? Use this line after setting Graphics3D:
glLightModeli(GL_LIGHT_MODEL_COLOR_CONTROL,GL_SINGLE_COLOR)'GL_SEPARATE_SPECULAR_COLOR)<--original value set by minib3d

Don't use Max2D, since it resets the lighting model.
If it helps, you need to adjust this in TGlobal.bmx and TBlitz2D.bmx.