Page 1 of 1

Transparent models?

Posted: 28 Nov 2007, 21:14
by Agon
Is it possible to use transparent models in spring?
I don't mean a total transparent. Something between two values, like RGB 0 to 255.

Posted: 28 Nov 2007, 21:49
by rattle
Nope.

Posted: 28 Nov 2007, 21:52
by Argh
With LUA, maybe. Trepan / Jk / Quantum / Whoever: can LUA get and read the primary / secondary texture of a given S3O now? Because alpha-trans should just require two OpenGL function calls, pretty much- read the blue channel, render model alpha per texel == blue value... if what I read on the OpenGL reference was as simple as it looked...

Posted: 28 Nov 2007, 22:40
by FLOZi
May as well use the alpha channel as it's already used for 1-bit transparency.

Posted: 28 Nov 2007, 22:47
by Argh
Yeah, but I suspect that might lead to borked results, since it'd get rendered twice, and the 1-bit thing is hard-coded.

Posted: 28 Nov 2007, 22:49
by KDR_11k
Lua can easily change the render mode of a unit. You'll have to manually Z-sort your polies if you use alpha though and that will be a pain.

Posted: 29 Nov 2007, 14:33
by LordLemmi
i think he means not the full model just a peace of it... and that could be a prob than or much lua code.

Posted: 29 Nov 2007, 19:22
by ianmac
Isn't a Commander transparent when he cloaks. Correct me if I'm wrong.

Posted: 29 Nov 2007, 19:30
by rattle
That's hardcoded.

Posted: 29 Nov 2007, 19:40
by Agon
Hm, a missed feature?
How hard would it be to include it into spring?

Posted: 29 Nov 2007, 19:54
by jK
it is damn hard to integrate.

As KDR said you need to z-order all those transparent polygons and render them in a 2nd render process (1. render all none transparent parts 2. render alpha transparent parts in correct z-order). The ordering is slow and you can't use buffered display lists anymore.

But Iirc can you set the drawing of an unit under full control of lua in the next spring release. But you would have to use a totaly different file format, if you want to use it to render alpha transparent parts, cause you need already to differ between 100% opac and alpha parts in the file format itself (lua is much slower in any cpu work, so you should still try to use display lists/vertex arrays etc. to shift work to the gpu).

Btw the full transparent model drawing (used for cloaking etc.) isn't 100% correct. You only can't see those issues 'cos the whole model is transparent! (-> not usable for alpha transparent units ...)