texture colors and vertices colors ?

Blitz3D Forums/Blitz3D Beginners Area/texture colors and vertices colors ?

RemiD(Posted 2016) [#1]
hello,

i just realized now that i may not be able to combine the colors of a texture and my custom vertices lighting/shading (using vertices colors), i hope that i am wrong (not tested yet), but here :
http://www.blitzbasic.com/b3ddocs/command.php?name=BrushFX
it is written :

BrushFX brush,fx

brush - brush handle

fx -
0: nothing (default)
1: full-bright
2: use vertex colors instead of brush color
4: flatshaded
8: disable fog
16: disable backface culling


does this mean only the color of the brush (set with brushcolor()) or also the colors of the texels of the texture (set with brushtexture()) ?
i hope that it only means the color of the brush...


_PJ_(Posted 2016) [#2]
Test it and see.

I use EntityFX +2 only in conjunction with LightMesh


RemiD(Posted 2016) [#3]
well, it seems that no, so this will complicate things for me...


Bobysait(Posted 2016) [#4]
the brush color is only the color you set with EntityColor (or BrushColor)
you can't use both
but, Fx 2 + a texture will work (depending on the texture blend mode -> you need to use Multiply or Add, else it will overwrite the current pixel color).


RemiD(Posted 2016) [#5]
oh maybe it is the blend mode, i used blendmode 1


RemiD(Posted 2016) [#6]
okay it works (texture colors + vertices colors ) :

Entityfx(Mesh,1+2) or Brushfx(Brush,1+2)
Entityblend(Mesh,1) or BrushBlend(Brush,1)
Textureblend(Texture,2 or 3 or 5)



RemiD(Posted 2016) [#7]
apparently, it is also possible to have texels colors and alpha (with a texture) + vertices colors this way :
Entityfx(Mesh,1+2) or Brushfx(Brush,1+2)
EntityBlend(Mesh,1) or BrushBlend(Brush,1)
LoadTexture("Texture.png",1+2) or CreateTexture(Width,Height,1+2)
Textureblend(Texture,2 or 3 or 5)
but if you don't use entityorder, there are z ordering problems (the shape which should be drawn before alphaed texels is sometimes drawn after...)


jfk EO-11110(Posted 2016) [#8]
Did I mention how to z sort alpha? well I did it with a high number of individual entity clones (copyentity), simply by reposition all of them in the order of their distance to the camera.

That's what I call an undocumented dx3d feature. ^^

It might be worth trying to reposition the vertices of a mesh the same way.


RemiD(Posted 2016) [#9]
@jfk>>i have been reading the posts that i have managed to find about how to prevent this z-ordering problem with surfaces using variable alpha texels/vertices and the tip mentioned was to have small separate meshes for shapes which use variable alpha so that the center of the shape is used as the 3dpoint for the distance from the camera calculation, so the smallest shape the better.
Another approach is to determine which shapes are the nearest/farest from the camera and to use entityorder (apparently with entityorder it works even when a shape is inside another shape...)
see : texels colors alpha + vertices colors

(bilinear filtering is desactivated in this example)

in any case, what i planned to do (merge different surfaces with different materials (with different colors alpha) in one surface one material and color alpha the surface using texels colors alpha or vertices colors alpha), fails because of the alpha z-ordering problem... but it works well for all materials using only colors... So i will probably create separate meshes for each shape using variable alpha...