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 dog_gy · Sep 07, 2014 at 04:21 AM · texturenormalsnormal mapdirectxdirectx 11

Normal maps turn red with DirectX 11 enabled

alt text

For some reason when I enable Use Direct3D 11 in the Player settings this happens. There's nothing unusual with the map, it's just a normal map with the Texture Type set to Normal map. No idea what could be wrong here :(

I tried searching but I haven't seen anything like this issue.

Edit: Furthermore I found that this is a problem in the shader and not just import settings. I use

 UnpackNormal(tex2D(_Normal, TRANSFORM_TEX(i.uv0.rg, _Normal)))
 

and without any texture plugged in it shows the correct color. Weirdly as soon as I add a texture it turns all red, even if I set my texture to not be a normal map (if I do this the texture appears correct in the preview unlike the original image I posted). I've linked an image of this right here.

Comment
Add comment
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

1 Reply

· Add your reply
  • Sort: 
avatar image
0
Best Answer

Answer by dog_gy · Sep 07, 2014 at 06:01 AM

I've solved this, sort of.

In place of UnpackNormal I did the conversion on my own. This appears correct on the mesh even when the Texture Type is set to Normal map (appearing that red color in the preview window) and with it set to Advanced and bypassing sRGB (where it appears the correct 8080ff normal color) as the other images I posted show.

                 fixed3 normalLocal = tex2D(_Normal, TRANSFORM_TEX(i.uv0.rg, _Normal));
                 normalLocal.rg = normalLocal.rg * 2 - 1;

When Unity shows the preview of the normal map it must be showing it with UnpackNormal being used or something. Here's why it doesnt work:

 inline fixed3 UnpackNormalDXT5nm (fixed4 packednormal)
 {
     fixed3 normal;
     normal.xy = packednormal.wy * 2 - 1;
     return normal;
 }

This is apparently called by UnpackNormal and pulls the alpha channel from the normal map rather than the red channel, and sets that to the red channel. This is really strange, like Unity isn't handling compression settings correctly with DX11 for some reason. This is beyond my knowledge though and I didn't find any compression settings that worked. For thoroughness here's the results using my conversion. First is the local normals. You can see the preview still looks wrong. The second is an NdotL, looks fine! alt text alt text

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

2 People are following this question.

avatar image avatar image

Related Questions

Problem with GetNativeTextureID() Unity 3.5 on Windows 1 Answer

Normal Map makes object look very bad in unity as opposed to in Blender. 0 Answers

Why unity use DX11 by default instead of DX12? 1 Answer

Normal and Bump Maps 0 Answers

Squares from normal and height map 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