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
2
Question by the_lemur · Jul 01, 2015 at 03:59 PM · meshlightingrenderprocedural mesh

Dynamic mesh is black except up-close

I'm making a bunch procedural blocks in code ( no, not cloning minecraft just a good practice for learning ) and i'm mapping textures onto the block faces with the uv coordinates provided by texture2D.PackTextures().

the problem is the mesh is completely dark unless I get really up close ( and then the far parts are still completely dark. ) also a lot of seams and lines appear. The material is using the Diffuse Legacy shader, though I've tried just about every shader and it doesn't work.

If I remove the uv textures, and just put a blank color, the color appears from any distance.

I've been looking at this for over 5 hours and I can't seem to fix it.

what it probably ISN'T:

the uv-coordinates are probably correct because when I go up close, the correct texture colors are all there.

the normals for the mesh are correct. ive both set them manually and used RecalculateNormals() and there is no difference.

there is lightning in the scene and other objects are lit properly.

the triangles all wend Clockwise and display correctly.

The GameObject has a MeshRenderer and a MeshFilter with both the atlas texture and the dynamic mesh supplied.

Some sample code:

uvRect = atlas.GetTexCoords( type ); // Custom class encapsulates an atlas and the uv-rect. returned values are verified correct.

vertexIndex = vertices.Count;

                     vertices.Add( new Vector3( x, y+1, z) );
                     vertices.Add( new Vector3( x, y+1, z+1 ) );
                     vertices.Add( new Vector3( x+1, y+1, z+1 ) );
                     vertices.Add( new Vector3( x+1, y+1, z ) );
                     
                     // triangles
                     triangles.Add( vertexIndex );
                     triangles.Add( vertexIndex+1);
                     triangles.Add( vertexIndex+2 );
                     //
                     triangles.Add( vertexIndex+2 );
                     triangles.Add( vertexIndex+3 );
                     triangles.Add( vertexIndex );

                     uvs.Add( new Vector2( uvRect.x, uvRect.y ) );
                     uvs.Add( new Vector2( uvRect.xMax, uvRect.y ) );
                     uvs.Add( new Vector2( uvRect.xMax, uvRect.yMax ) );
                     uvs.Add( new Vector2( uvRect.x, uvRect.yMax ) );

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
1

Answer by the_lemur · Jul 01, 2015 at 05:32 PM

Turning mipmaps off on the original textures (surprisingly) solves the far-lightning problem.

All that remains is the ugly-seams problem and some odd color effects at a distance.

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

Lighting Banding Artifact 0 Answers

Strange point light on generated mesh 1 Answer

Light passing through walls in android build but not in editor 1 Answer

Light creates distortion on mesh? 1 Answer

Simple plane generation 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