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 /
This post has been wikified, any user with enough reputation can edit it.
avatar image
0
Question by riko642 · Jan 03, 2014 at 05:17 PM · shadermeshlightingprocedural

How to change type of shading?

I am generating a mesh procedurally, but I am facing the following problem with shading: When I split a flat parallelogram (highlighted in the figure 3) into triangles, the light reflection doesn't look realistically (figure 1). Is there any way how to change shading from gouraud (if I am right and this is currently set) to flat or phong? Or is the problem somewhere else?

image output

column.png (350.7 kB)
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

Answer by Kiloblargh · Jan 03, 2014 at 05:45 PM

The shading just interpolates from one vertex to the other. When an imported model has hard edges, what that really means is it has two sets of overlapping vertices in the same place on that edge- one set that goes with one side of the edge, and another set that goes with the other side.

I think the only thing that is going to fix this to your satisfaction is creating a bevel. So instead of a single edge, you have two edges close together. That way the entire light-to-dark gradation will be confined to the small area between the two edges and not "leak" across the entire front face.

I don't envy you having to figure out a procedural edge-beveling algorithm but if you're already procedurally generating architecture, I'm sure you can do it and if this were my project, that's what I'd get started working on now.

Comment
Add comment · Show 6 · 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
avatar image riko642 · Jan 03, 2014 at 05:54 PM 0
Share

Is there any way how to use polygons ins$$anonymous$$d of triangles? This would also solve the problem

avatar image Kiloblargh · Jan 03, 2014 at 05:59 PM 0
Share

No. "Using polygons ins$$anonymous$$d of triangles" is just a way of saying "hiding the fact that you're using triangles" because everything has to become triangles by the time it is fed to the GPU.

avatar image riko642 · Jan 03, 2014 at 07:35 PM 0
Share

@$$anonymous$$iloblargh The problem with your solution is that I would have to create more unnecessary polygons, and this is way I want to avoid.

avatar image riko642 · Jan 03, 2014 at 07:46 PM 0
Share

is it possible to define hard edges? or can there be a problem with normals? (I've used RecalculateNormals()) or smoothing angle?

avatar image Kiloblargh · Jan 03, 2014 at 08:34 PM 0
Share

Hard edges do create extra vertices, because a vertex can only have one normal. A smooth edged cube has 8 verts. A hard edged cube has 24 verts.

This appears to be background geometry. Could you get away with using an unlit, vertex colored shader with pre-baked lighting in the vertex colors? That might give you better control over the shading so you can hide the triangle artifacts and be enough faster than real-time lighting that you can afford more polys.

Show more comments

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

18 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Custom shader light blending 0 Answers

Generated mesh loses lighting at certain angles 2 Answers

MODEL TURNS BLACK AFTER APPLYING TEXTURE PLS HELP 3 Answers

What are normals? 1 Answer

Procedural array of meshes problem / solved 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