Page 1 of 1

Faking Sloped, Transparent Geometry

Posted: Mon Apr 16, 2018 3:40 pm
by RockstarRaccoon
So, after my feature request was denied on the fact that they'd have to rework the rendering process for it to work, I looked into a workaround for rendering geometry that is both sloped and translucent.

I managed to do it with pitched flat sprites with no physics presence, and invisible 3D floors for collision. In order to create the piece of geometry I desired (a 45 degree ceiling window to an alien greenhouse), I put the solid, yet completely unrendered 3D floor where I needed it to be, and made an actor which used the texture of the glass. I then carefully positioned the flatsprite actors directly over the 3D floor, so they'd be rendered where the 3D floor wouldn't.

The result is in the image. (Obviously there are some problems with my alignment, but that will be fixed through further tweaking)
Spoiler:
This is the code of the sprite things.

Code: Select all

ACTOR Abstract_FakeTexture {
	-SOLID
	+NOGRAVITY
	+NOBLOCKMAP
	+NOCLIP
	+NOTRIGGER
	+Flatsprite

	Radius 32 // I made it wide so it'd be easy to grab in 3D mode
	Height 8 // I made it short so I could put it close to a sky ceiling
}
ACTOR Tex_LabGlass : Abstract_FakeTexture 13668 {
	RenderStyle Translucent
	Alpha 0.2

	States {
		Spawn:
			T_LG A -1
			Loop
	}
}
ACTOR Tex_LabGlass_45 : Tex_LabGlass 13669 { // Specially suited for lining it up at a 45 degree angle.
//	Pitch 45
	YScale 1.4142 // This is the length of the hypotenuse of a right triangle where both sides are 1.
}

Re: Faking Sloped, Transparent Geometry

Posted: Mon Apr 16, 2018 3:43 pm
by Graf Zahl
Be aware that this cannot be properly sorted so it may glitch quite badly.

Re: Faking Sloped, Transparent Geometry

Posted: Mon Apr 16, 2018 3:48 pm
by RockstarRaccoon
Graf Zahl wrote:Be aware that this cannot be properly sorted so it may glitch quite badly.
Really? Can I get more details? So far it's working fine where I used it, but yeah, I'm sure there's a problem here if someone tried to use it for something more complicated...

I was going to also use a similar method, along with MD3 models, for some complicated door, grass, and suspended-stair geometry...

Re: Faking Sloped, Transparent Geometry

Posted: Mon Apr 16, 2018 4:05 pm
by Graf Zahl
Same reason why translucent sloped 3D floors cannot be done: To render translucency correctly it needs to be properly sorted. And sprite sorting right now is a simple distance sort so any sprite coming near such a thing will inevitably produce some visual artifacts.

Re: Faking Sloped, Transparent Geometry

Posted: Mon Apr 16, 2018 5:00 pm
by RockstarRaccoon
Thanks for the info. Good to know!