Mixed rendering [toon+ shadows]

Previous topic - Next topic

jtassinari

Hi there,

I tried to mix 2 different rendering, shadows + toon shading on an animated mesh.
Actually the result isn't that bad, but the animated mesh is rendered with strange triagnles illumnated coming out as if i'm mixing 2 different shapes or the animation isn't in sync...

Here is a pict:


and maybe an avi could better explain the problem...

http://www.absolute-line.net/http://www.absolute-line.net/wp-content/uploads/2010/12/C40543457284.avi

and some of the code
Code (glbasic) Select


WHILE TRUE
f = f + 1
X_MAKE3D 1, 500, 45
X_CAMERA 6, 6, 6, -3,-3,-3
X_SETTEXTURE 1, 1
IF f > 900 THEN  f = 0
X_SPOT_LT -2, RGB(155, 155, 155), 50,50,-50, -50,-50,50, 180
X_SCALING 10, 1, 10
X_DRAWOBJ plane, 0
FOR shadow = 0 TO 1
X_CULLMODE 1
IF shadow
X_SPOT_LT -3, RGB(155, 155, 155), 50,50,-50, -50,-50,50, 360
ELSE
X_SPOT_LT -2, RGB(155, 155, 155), 50,50,-50, -50,-50,50, 180
ENDIF
X_SCALING 1, 1, 1
X_DRAWANIM eggman, 0, 9, f/100, TRUE
NEXT
X_DRAWAXES 0,0,0
X_MAKE2D
SHOWSCREEN

WEND



Is this a bug? any idea?
Cheers,

jT
- [ http://www.absolute-line.net ] -
(please forgive my bad English)

Kitty Hello

It does not overdraw all the places, maybe. What if you try X_CLEAR_Z, or swap the drawing order?

jtassinari

Thanks Kitty,
i tried to add the code somewhere (almost anywhere) testing some changes, but i haven't been able to succede.
where in the code should i add it?

BTW, HAPPY NEW YEAR =)

Cheers,

jT
- [ http://www.absolute-line.net ] -
(please forgive my bad English)

jtassinari

Hi there,
after some more test, i got the point. It has to do with the X_drawanim.

here is a video to see the difference:
http://www.absolute-line.net/http://www.absolute-line.net/wp-content/uploads/2011/01/C40545442432.avi

Code (glbasic) Select

WHILE TRUE
f = f + 1
IF f > 100 THEN f = 0

X_MAKE3D 1, 500, 45
X_CULLMODE 1

X_CAMERA 6, 6, 6, -3,-3,-3
X_SPOT_LT -2, RGB(255, 255, 255), 50,50,-50, -50,-50,50, 180

X_SETTEXTURE 1, 1
X_SCALING 10, 1, 10
X_DRAWOBJ plane, 0
FOR shadow = 0 TO 1
IF shadow
X_SPOT_LT -3, RGB(255, 255, 255), 50,50,-50, -50,-50,50, 360
ELSE
X_SPOT_LT -2, RGB(255, 255, 255), 50,50,-50, -50,-50,50, 180
ENDIF
X_SCALING 1, 1, 1
//X_DRAWANIM eggman, 0, 9, f/10, TRUE // <= Smooth transition & interpolation
X_DRAWOBJ eggman, f/4 // <= Sharp transition, no interpolation
NEXT
X_DRAWAXES 0,0,0
X_MAKE2D
SHOWSCREEN
WEND



Using a normal X_DRAWOBJ and calling each frame, i have a nice shoadows and shape.
While using  X_DRAWANIM, I'm not going anywhere.
I suppose this is a X_DRAWANIM bug.
I'll try somemore =)

Cheers,

jT
- [ http://www.absolute-line.net ] -
(please forgive my bad English)

Kitty Hello

the problem is Z-fighting. In either mode you're only partially overwriting previously drawn pixels.
Try rendering the model that you don't want to see (the shadow one) first with ALPHAMODE 0.0001

Very strange what you want to do.

jtassinari

Hi Kitty,

I did some testing using the Alphamode in different values/position, and I haven't arrived at anything usefull.
As I have written above, it looks like using X_DrawObj (calling each frame) it works fine, while with X_DrawAnim it is not.
My theory (just) is that there is a kind of appostimation value in the calc of the triangles when X_DrawAmin is calculating the difference among tow different position of the shape (if it works like this!!!).

QuoteVery strange what you want to do.

I like to experiment  =D, but as i like a better render then a straight sharp one,... I got here as an experiment  ;/
This is not meaning that it sould not work...

Thanks
jT
- [ http://www.absolute-line.net ] -
(please forgive my bad English)