x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

How to center a texture using objectPositionWS

Hi, I have a mesh with bad UV mapping. The texture and the mesh have to be cocentric. I want this to be automatic so I don't have offset the texture manualy. alt text

My idea is to use the worldAlignedTexture node to bypass the UV problem. I want the center of my texture to be at the center of the bounds. I think Ihave to use the objectpositionWS node to get the position of the center of the bounds, but I don't know how to use it in the worldAlignedTexture node.alt text Has anyone done something similar?

Product Version: Not Selected
Tags:
capture.png (797.4 kB)
capture2.png (208.7 kB)
more ▼

asked Jun 30 '17 at 10:31 AM in Rendering

avatar image

f.collioud
1 2 3 2

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Try something like this. It will work for XY projection. Also I think you can calculate Size by 1/ObjectRadius or one of options in ObjectBounds.

Offset parameter added to make additional adjustments for 'relative texture location'.

alt text

more ▼

answered Jun 30 '17 at 11:11 AM

avatar image

redbox
4.3k 81 19 104

avatar image f.collioud Jun 30 '17 at 01:39 PM

Thanks, it does center the texture perfectly when I offset it by 50,50,0,1. alt text

To addapt the size I tryed to use radius to scale it whith no success. Using OptionBounds just make UE4 chrash...

capture3.png (1.3 MB)
avatar image redbox Jul 03 '17 at 08:16 AM

You want to change its size in game?

If not, just set size values manually.

If yes - you can try to multiply size parameter on ObjectScale, and set size values manually also.

avatar image f.collioud Jul 03 '17 at 01:13 PM

I want the size of the texture to match the size of the object. That way you dont see the white corners. I also ran into another problem. I tried to rotate the object aroud the y axis and the texture didn't follow. Not sure it is possible to avoid that though.

avatar image redbox Jul 03 '17 at 01:18 PM

You can adjust size manually, by measuring object size in editor.

With rotation this setup will not work.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question