Welcome to od|forum

Register now to gain access to all of our features. Once registered and logged in, you will be able to contribute to this site by submitting your own content or replying to existing content. You'll be able to customize your profile, receive reputation points as a reward for submitting content, while also communicating with other members via your own private inbox, plus much more! This message will be removed once you have signed in.

Mzigaib

UV cubic map procedurally

It seems simple but I couldn't figure out how to procedurally create a cubic UV map fora a simple 6 sides cube, Any tips?

Thanks.

Share this post


Link to post
Share on other sites

Thanks for the feedback.

Is about the way the uvs are layed, it needs to be layed follow a cubic vertical environment cube.

UV unwrap works for texturing but it doesn´t position the uv´s right away with the cross cubic env image you have to do it by hand. Does it make sense?

Share this post


Link to post
Share on other sites

You can do this by doing 6 separate projections (UV texture or UV project) for each side to the cube and move them in position.

If you simply do that upfront, you can afterwards change the cube and the UVs should remain intact.

You could even morph this cube in a quad sphere if that is what you are looking for.

Shameless self plug is shameless:

http://www.twandegraaf.nl/Art/Documents/Procedural%20planets%20into%20detail,%20Twan%20de%20Graaf%202012.pdf

see page 6.

1 person likes this

Share this post


Link to post
Share on other sites

Here is a vertexwrangle method for projecting cubic UVs on any kind of mesh:

vector bbox = relbbox(0, @P);
vector side = sign(@N);
vector nml  = abs(@N);

vector size  = getbbox_size(0);
vector ratio = size / max(size);
vector scale = bbox * ratio;

if      (nml.x == max(nml)) { @uv = set(scale.y * side.x, scale.z, 0);             }
else if (nml.y == max(nml)) { @uv = set(scale.x * side.y, scale.z, 0); @uv.y += 1; }
else                        { @uv = set(scale.x * side.z, scale.y, 0); @uv.y += 2; }

@uv *= 0.3333;
@uv.x += 0.5;

 

cubic_vert_UVs.jpeg

Edited by konstantin magnus
5 people like this

Share this post


Link to post
Share on other sites

I tried a similar thing a while back, its a fair amount of script to position the uv projections on each side of the box

Hope it helps

 

 

Share this post


Link to post
Share on other sites

Thanks Konstantin, it seems to work well for spaceship parts.

 

Now I can finally paint my ships in Mari!

Untitled-1.jpg

Edited by Atom

Share this post


Link to post
Share on other sites
20 minutes ago, Atom said:

Thanks Konstantin, it seems to work well for spaceship parts.

Hehe cool, makes me proud to see it´s of any use!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now