How To Make Decals?


👉 BlitzCoder will be building a new platform and other plans to preserve and continue the Blitz legacy.

To be able to achieve this goal, we need your support by becoming a Patreon Paid Member 👈

 

Tweet 3d blitz3d
Loud64

i want to make decals but i don't know how to do them, I'm not really a pro Blitz3D programmer but i know a couple of things about it.

Loud64 commented:

Why is no one replying :(

ceeminus commented:

best bet is look in the old forum so start with search

RemiD commented:

if by 'decal' you mean a trace of impact (of a projectile or a sword), the idea is to align a quad or a 3d mesh to the normal of the triangle of a surface.

to determine the point of impact, and the normal of impact, you can use ellipsoids (sphere to mesh collision detection), or linepicks (3d ray to mesh collision detection).

useful commands are :
collidedentity(), collisionX(), collisionY(), collisionZ(), collisionNX(), collisionNY(), collisionNZ()
pickedentity(), pickedX(), pickedY(), pickedZ(), pickedNX(), pickedNY(), pickedNZ()
aligntovector()

there must be a few examples of that in the samples or code archives...

samples/mak/castle/
samples/zenith/scare/

Loud64 commented:

@RemiD I'am talking about texture decals, like blood on the wall, or cracks on the wall.

RemiD commented:

this is exactly what i have described, how such thing is made in games...

you could theoricaly also draw directly on the textures of the walls, but you would have to have an uniform texel size, for it to look convincing, and it would be slower to draw.

Loud64 commented:

@RemiD can you just mask the texture does it not work like that? sorry im kinda of a newbie in BlitzBasic

RemiD commented:

with blitz3d, i see 3 ways to make decals :

  • a 3d shape positionned at the point of the impact, oriented along the normal of the surface (of a wall, floor, ceiling, furniture, container, tree)

for example : https://www.blitzcoder.org/forum/topic.php?id=1545&post=1

  • a 3d textured quad (a square mesh) positionned at the point of the impact, oriented along the normal of the surface (of a wall, floor, ceiling, furniture, container, tree)

for example : https://www.blitzcoder.org/forum/topic.php?id=1546#1

  • drawing directly on the texels of the texture of the surface (of a wall, floor, ceiling, furniture, container, tree), at the position of impact, but in this case the texel size must be uniform enough on all the things in the environment (wall, floor, ceiling, furniture, container, tree), to look convincing and consistent, which is not easy to do, but doable, and most likely slower...

for example : https://www.blitzcoder.org/forum/topic.php?id=217

Reply To Topic (minimum 10 characters)

Please log in to reply