Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by Rhogar · Feb 27, 2015 at 04:05 PM · textureoffsetdistortion

Avoiding Distortion with Parallax Texture Offset

Hi everyone, we're working on a parallax background system at the moment. Using a perspective camera to have multiple layers of background images on planes, where I have the textures of all of them being offset in the X direction as the player moves. This works exactly as planned.

The issue is that we have textures larger than the planes- for longer levels- and when we apply the texture to the planes the texture distorts to fit the plane width. Is there a way to not stretch the texture to fit, so it acts as more of a mask for the texture? We want to try and avoid making the planes the same size as the texture/aspect ratio of the images and messing around with the distance from the camera to keep the images looking good.

I attached a couple of reference images. Ideally, when shrunk the plane shows the same amount of the texture as it did when it was larger instead of squeezing down to fit the smaller space. alt textalt text

Any thoughts or direction would be helpful!

large-plane-no-distortion.png (135.7 kB)
small-plane-distorted.png (124.5 kB)
Comment
Add comment · Show 3
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image meat5000 ♦ · Feb 27, 2015 at 04:28 AM 0
Share

Got a question here?

avatar image Rhogar · Feb 27, 2015 at 04:50 AM 0
Share

As I said in the post; "Is there a way to not stretch the texture to fit, so it acts as more of a mask for the texture? We want to try and avoid making the planes the same size as the texture/aspect ratio of the images and messing around with the distance from the camera to keep the images looking good." I'm not sure if I mislead you somehow with that, we want to know if there's a way to apply a texture without it stretching to fit the object for this parallax effect

avatar image SaraCecilia · Feb 27, 2015 at 09:11 AM 0
Share

What have you tried already that didn't work out? Did you check out the solutions other users have, such as: http://answers.unity3d.com/questions/233902/textures-stretch-on-wide-objects.html , http://forum.unity3d.com/threads/texture-stretch.119278/ , http://answers.unity3d.com/questions/775619/texture-stretches-when-tiled-in-editor.html , http://answers.unity3d.com/questions/361573/how-to-make-a-texture-tile-and-not-stretch.html ,

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by kru · Feb 28, 2015 at 06:33 AM

In order to make the smaller plane show the same texel density as the stretched plane, you're going to have to change the UV offsets and tiling properties of your background material. Select the material which is on the small plane, locate the X/Y offset and tiling properties. As you change them, you'll notice the image move and warp.

You'll want to write a script which can change these numbers for you as the camera moves around your level. The math isn't challenging, but it does take some thought. Get your script writer with the most confidence in his or her mathematics to Google around for parallax algorithm for a day.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

Bullet Mark Texturing offset too far 1 Answer

mainTextureOffset not updating via script 1 Answer

SkinnedMeshRenderer offset UVs to match texture atlas? 1 Answer

Masking a plane object (which has an animated texture offset) 1 Answer

The correct way of making Texture Atlas 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges