Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
13 Jun 22 - 14 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 vlames · Jul 15, 2014 at 12:33 PM · textureoffsetbumpmap

can't offset normal map

the offset of the normal map seems to be linked to the main texture, is normal map offset a pro only feature? or am I missing something here?

this is my code:

 #pragma strict
 //javascript
 
 var Offset : Vector2;
 var Speed : float = 0.1;
 
 function Update () {
 Offset = renderer.material.GetTextureOffset("_BumpMap");
 Offset.y += Speed;
 renderer.material.SetTextureOffset("_BumpMap", Offset);
 }

I've tried changing it in the inspecor but that doesnt work either

Comment
Add comment · Show 1
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 gitoffame · Jul 15, 2014 at 02:52 PM 0
Share

Are you able to offset the main texture? Here's a sprite sheet animator I wrote that you can $$anonymous$$r apart if that helps... I know it scrolls through textures, though I haven't tried it with normal maps specifically. It's probably way more than what you're looking for, but maybe you can find what you need in there...

 var sheetRows : float;
 var sheetColumns : float;
 var duration : float;
 var curFrame : int = 1;
 var incrementX : float;
 var incrementY : float;
 var loop : boolean = true;
 var loopCount : int;
 var animate : boolean = true;
 var curRow : float = 1;
 var curCol : float = 1;
 var initialOffset : Vector2;
 private var totalFrames : int;
 private var animationStart : float;
 private var lastFrame : float;
 
 function Awake()
 {
 initialOffset = renderer.material.mainTextureOffset;
         
 //renderer.material.mainTextureOffset.y = 1 - (1 / sheetColumns);
 
 curFrame = 1;
 curRow = 1;
 curCol = 1;
 
 if (duration <= 0)
 {
 duration = totalFrames;
 }
 
 if ((sheetRows > 0) && (sheetColumns > 0))
 {
     incrementX = 1 / (sheetRows);
     incrementY = (1 / (sheetColumns)) * -1;
     totalFrames = sheetRows * sheetColumns;
     }
     
     else
     
     {
     print ("Remember to set sprite sheet's column and row count.");
     }
 }
 
 function Update()
 {
     if ((animate) && (Time.time >= lastFrame + (duration / totalFrames)))
     {
         advanceFrame();
     }
 }
 
 function advanceFrame()
 {
     lastFrame = Time.time;
     
     renderer.material.mainTextureOffset.x += incrementX;
     
     curCol += 1;
     curFrame += 1;
     
     if (curCol > sheetColumns)
     {
         curCol = 1;
         
         renderer.material.mainTextureOffset.x = 0;
         
         renderer.material.mainTextureOffset.y += incrementY;
         
         curRow += 1;
     }
     
     if (curFrame > totalFrames)
     {
         ResetOffset();
     }
 }
 
 function ResetOffset()
 {
 
         renderer.material.mainTextureOffset = initialOffset;
         
         curRow = 1;
         curCol = 1;
         curFrame = 1;
 }
 
 function playAnimation()
 {
     animationStart = Time.time;
     
     animate = true;
 }
 
 function pauseAnimation()
 {
     animate = false;
 }
 
 function animationStop()
 {
     animate = false;
 
     renderer.material.mainTextureOffset = initialOffset;
     
     curFrame = 1;
 }

1 Reply

· Add your reply
  • Sort: 
avatar image
0

Answer by Svyatoslav-Pilipenko · Feb 06 at 07:05 AM

На братан)

pragma strict

//javascript

var Offset : Vector2; var Speed : float = 0.1;

function Update () { Offset = GetComponent.().material.GetTextureOffset("_BumpMap"); Offset.x += Speed; GetComponent.().material.SetTextureOffset("_BumpMap", Offset); }

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

Texture Offset - bump AND main color 3 Answers

How can I create a UV move tool? 1 Answer

Importing and configuring Normal Maps at runtime ? 2 Answers

Animation Tiling/Offset 0 Answers

Animated Texture doesn't begin at first frame 1 Answer


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