Community
Maya Forum
Welcome to Autodesk’s Maya Forums. Share your knowledge, ask questions, and explore popular Maya topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to add an image to a Plane and preserve aspect ratio?

8 REPLIES 8
SOLVED
Reply
Message 1 of 9
litote
5429 Views, 8 Replies

How to add an image to a Plane and preserve aspect ratio?

Is there a simple way to place an image on to a Plane as a texture and get the right aspect ratio so the image appears to fill the plane without distortion?

My current method is to create a Plane with the same aspect ratio, e.g. 1280x720 for an image of the same aspect/dimension, and add the image to the aiStandardSurface shader’s Base-Color as a 2D Textures File node and in the place2dTexture tab set these values for Repeat UV: 1; 1.778 (where 1.28/0.72 = 1.778).

Thanks

8 REPLIES 8
Message 2 of 9
sean.heasley
in reply to: litote

Hi @litote

 

You can go to the attributes on your camera and add an image plane. Then under the enviroments tab open your image in there. This will keep your ratio the way it should be.

 

Let me know if this helps or if you need any more information!

 

 

If one or more of these posts helped answer your question, please click Accept as Solution on the posts that helped you so others in the community can find them easily.

 

 

 

Kudos are greatly appreciated. Everyone likes a thumbs up!

Message 3 of 9
sean.heasley
in reply to: sean.heasley

Hi @litote

 

I'm just checking in again to see if you need more help with this. Did the suggestion I provided yesterday work for you?

If so, please click Accept as Solution on the posts that helped you so others in the community can find them easily.

Message 4 of 9
litote
in reply to: sean.heasley

Thanks, I came up with this solution tinkering about, but it does not appear to work with Arnold materials that are refractive. The BG image plane does not refract in a refractive glass material. Instead it seems to require the image be on geometry -- a Plane primitive.

 

This has its own problems as you need to light the Plane correctly and mess about with UV tiling, disable receive shadows etc. If you add the material to the Emission attribute of an aiStandardSurface material then the BG Plane emits light on to objects, also a problem.

Message 5 of 9
litote
in reply to: litote

On further tinkering, my solution for making a background image interact with refractive materials and have the correct aspect ratio is to add it to an aiStandardSurface shader's Emission-Color parameter (set Weight to 1) to a Plane of the same aspect ratio as the image and adjust its Repeat UV (in place2DTexture node/tab) to get the correct aspect ratio. The Plane is needed since refraction seems to require real geometry to interact with (same as in C4D).

 

To determine the correct aspect, divide the image width by height. e.g. For a 1280x720 image (16:9), 1280/720= 1.777777…, so set Repeat UV: 1.000; 1.778, where 1 represents height, 1.778 is width.

 

Then in Arnold-Visibility rollout for the Plane's shape node/tab uncheck everything except Primary Visibility and Specular Transmission (for it to show in refractive objects — you can choose to check Specular Reflection).

 

Or you can use a Maya Surface Shader and instead add the image to the Out Color, then follow the same steps.

Message 6 of 9
mspeer
in reply to: litote

Hi!

 

Your solution only works for a quadratic plane (maybe that's what you want) and you'll get a texture repetition or an empty area.

 

Just create a Nurbs Plane and enter the correct Length Ratio for the nurbsPlane, no need to hassle with UV's.

You could also create such an Attribute (Add Attribute) for a Polygon Plane.

 

Message 7 of 9
litote
in reply to: mspeer

Thanks -- great tip about using a NURBS Plane.

 

I don't follow what you mean by adding an Attribute to a polygon Plane? Would you please elaborate?

Message 8 of 9
mspeer
in reply to: litote

Hi!

 

For example create an expression that controls scaling in one direction based on a ratio value set by a custom Attribute.

 

Please read the Maya Online Help / Documentation for more details about custom attributes.

Message 9 of 9
grattray
in reply to: sean.heasley

how do I make the backround of the image clear. When I try to upload an image, the backround keeps the white outline.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report