Faking Sloped, Transparent Geometry

Ask about mapping, UDMF, using DoomBuilder/editor of choice, etc, here!

Moderator: GZDoom Developers

Forum rules
Before asking on how to use a ZDoom feature, read the ZDoom wiki first. If you still don't understand how to use a feature, then ask here.
Post Reply
User avatar
RockstarRaccoon
Posts: 598
Joined: Sun Jul 31, 2016 2:43 pm

Faking Sloped, Transparent Geometry

Post 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.
}
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49066
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Faking Sloped, Transparent Geometry

Post by Graf Zahl »

Be aware that this cannot be properly sorted so it may glitch quite badly.
User avatar
RockstarRaccoon
Posts: 598
Joined: Sun Jul 31, 2016 2:43 pm

Re: Faking Sloped, Transparent Geometry

Post 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...
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49066
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: Faking Sloped, Transparent Geometry

Post 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.
User avatar
RockstarRaccoon
Posts: 598
Joined: Sun Jul 31, 2016 2:43 pm

Re: Faking Sloped, Transparent Geometry

Post by RockstarRaccoon »

Thanks for the info. Good to know!
Post Reply

Return to “Mapping”