Triplanar mapping to generate UV coords for meshes?

👉 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 👈



Ok so I'm making a world editor to make it easier to create games in blitz3D.

One of its features is to generate meshes using quads or cubes. I have it so that the UVs are generated at mesh creation, so I don't have to texture paint post-creation. However, the problem I have is that I cannot generate UV coordinates based on world space projection of a texture. Only progress I've made is to generate texture tiling based on quad length.

This is okay as long as all the edges are parallel. Once the quad becomes an irregular shape, it's distorted.

For more context, check out this link to see what I'm talking about.

What I want to accomplish, is an algo to generate UV coordinates for a quad using projection. Think of Blender's "Cube projection" UV unwrapping option. It generates UV coords for you when none are available, which conform to the quad's shape.

I tried to implement this myself and have failed. If anyone can help me with this using actual B3D code, I'd greatly appreciate it. :)

CraigTheCoder commented:

I started with those code archives, as well as some articles on Google. Unfortunately, those didn't help me. The pickedUV example gave me an idea though, but I suppose I'll have to let it go for now.

RemiD commented:

maybe this code can give you some ideas :

CraigTheCoder commented:

Thanks for the links. I also found an actual box mapper by birdie, but I think my current implementation while garbage IMHO, is better.

I also wanna take a minute to thank you for the vertex lighting code. That's really useful and portable! :D

Reply To Topic (minimum 10 characters)

Please log in to reply