GMLscripts.com

Discuss and collaborate on GML scripts
Invert

You are not logged in.

#1 2020-07-28 18:29:23

digycore
Member
Registered: 2020-07-28
Posts: 6

alpha expert

Hello I am looking for an alpha graphics expert. You see I have made a decal system with Game Maker but there are a bit of alpha issues when looking at some of the decals.

Offline

#2 2020-08-05 13:26:24

xot
Administrator
Registered: 2007-08-18
Posts: 1,215

Re: alpha expert

You'll need to be more specific about the problems you're having.


Abusing forum power since 1986.

Offline

#3 2020-08-09 09:07:54

digycore
Member
Registered: 2020-07-28
Posts: 6

Re: alpha expert

Ok. I am trying to get 3d decals in game maker. I am using the tutorial of Mike Daily. It works for 3d but was not meant for 3d, so it has a problem when decals on different walls overlap each other in the camera view.

https://host-a.net/f/254349-workingdecalsprojectgmz

Offline

#4 2020-08-10 00:31:14

xot
Administrator
Registered: 2007-08-18
Posts: 1,215

Re: alpha expert

I don't think this problem can be solved the way you are trying to do it.

Option 0: Don't do this with GameMaker.

Option 1: Make sure every decal is within the geometry of the wall.

Option 2: Every wall has its own texture and decals are applied to that texture.

Option 3: The decal is a quad whose vertices are projected onto and clipped by the geometry it is being placed on.

Option 4: A texture bomb shader with a limited number decals. Decals positions, orientations, and textures are passed to the shader and blended with base texture. Walls and decals are rendered in one pass but each wall would have to the drawn individually.

Option 5: Decals drawn with a shader using a special z-testing rule. Rather than drawing where the decal's z is less than the z-buffer value, draw only where the decal's z is within a small threshold of the z-buffer value. The trick is sampling the z-buffer which GMS doesn't make easy. World geometry would have to be drawn in a special pass to a texture shaded with depth its depth values. A second shader draws the decals testing against that. I have no idea if this is actually practical.

Those are my thoughts. This is not a problem I've ever tried to solve. Good luck.


Abusing forum power since 1986.

Offline

#5 2020-08-10 08:09:04

digycore
Member
Registered: 2020-07-28
Posts: 6

Re: alpha expert

mathmatically clipping is hard because if the decal spans multiple triangles you have to do expensive collision checks for each triangle it spans.

Offline

#6 2020-08-10 14:46:46

xot
Administrator
Registered: 2007-08-18
Posts: 1,215

Re: alpha expert

Yes, it's nontrivial but it only needs to be done once. I believe Option 3 is how most older games do it.

Unity has an in-built Decal shader like Option 4, though very limited. There are more advanced ways to do this sort of texture bomb shader that would not require drawing each wall individually but it would require using vertex buffers instead of simple 3D primitives.

Here is some reading material if you want to learn more about how some of the suggested techniques work:
How to project decals
Drawing Stuff On Other Stuff With Deferred Screenspace Decals
Forward+ decal rendering


Abusing forum power since 1986.

Offline

#7 2020-08-11 19:37:40

digycore
Member
Registered: 2020-07-28
Posts: 6

Re: alpha expert

uh ok..

Offline

Board footer

Powered by FluxBB