3D Alpha

Previous topic - Next topic

matchy

Objects that are drawn with an opaque alphamode only allow other objects that have been pre-drawn to be seen thru. Is there a way for post-drawn objects?


Code (glbasic) Select
// Sample of triangles drawn behind first are only opaque.
funStart3DAlpha()

FUNCTION funStart3DAlpha:
funCreateTriangle(0)
funAnimate()
ENDFUNCTION

FUNCTION funAnimate:
LOCAL z

WHILE TRUE
X_MAKE3D 1,10, 45
X_CAMERA 0, 0.25, -2, 0, 0, 4
ALPHAMODE 0.075
FOR z=1 TO 3
X_MOVEMENT -1,  0, 4-z
X_DRAWOBJ   0, -1
NEXT
FOR z=1 TO 3
X_MOVEMENT  1,  0, z
X_DRAWOBJ   0, -1
NEXT
SHOWSCREEN
WEND
ENDFUNCTION

FUNCTION funCreateTriangle: num
LOCAL col

col=RGB(255,255,255)
X_OBJSTART num
X_OBJADDVERTEX -0.5,  0.5, 0.0,  0.1, 1.0,  col
X_OBJADDVERTEX  0.0, -0.5, 0.0,  0.5, 0.0,  col
X_OBJADDVERTEX  0.5,  0.5, 0.0,  0.5, 1.0,  col
X_OBJEND
ENDFUNCTION


[attachment deleted by admin]

Hemlos

You need to z-order the objects, need more processing.

For billboarding, Point sprites are coming in the future, these might solve blending in non ordered systems, i dont really know.
Bing ChatGpt is pretty smart :O

matchy

It's like i need to toggle the z-order only for the certain objects but it's not important for now.  :good:


Hemlos

Quote from: matchy on 2009-Nov-22
It's like i need to toggle the z-order only for the certain objects but it's not important for now.  :good:

Hmm, there are objects that will render translucent, without z ordering?
Bing ChatGpt is pretty smart :O

matchy

The order the the objects that are X_OBJDRAWn determines the translucency to the next object. That is, they are still see through, but other other objects are not seen through. For example, a player in the middle of a map can see through translucent object that are to the -x & -z from the player . This is the same for X_SPRITE.

Hemlos

I know what youre talking about now.
It is accidental z ordering.
Youll still experience blending issues in the -z direction of the cam also , if the ordering fluxuates.

Bing ChatGpt is pretty smart :O