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 kechen00 · Jul 08, 2020 at 12:52 PM · forward rendering

What's the difference between per-pixel and per-vertex lit in Forward Rendering?

In my point of view, per-vertex lit calculates lighting color in vertex shader and then pass it to fragment shader after rasterization, while per-pixel lit calculates lighting color in fragment shader with interpolated normal passed from vertex shader.


In terms of unity's Forward Rendering, it's saying that:

In Forward rendering, some number of brightest lights that affect each object are rendered in fully per-pixel lit mode. Then, up to 4 point lights are calculated per-vertex.

Data of the 4 per-vertex lights are packed in built-in variables like unity_4LightPosX0 , unity_LightColor in ShaderLab.

What confuses me is that these variables can be access both in vertex and fragment shader, so isn't it the user's choice (calculating lights color in vertex or fragment shader) to implement per-vertex or per-pixel lit on the 4 unimportant lights?
Briefly:
- What's the meaning of 'per-vertex'/'per-pixel' in the description?
- What's the limitation of the 4 unimportant lights compared with the main per-pixel light?

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

2 Replies

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

Answer by kechen00 · Jul 09, 2020 at 11:50 AM

@JonPQ Thank you. I have exactly the same understanding on per vertex/pixel lit with you. But what actually confused me was that, with the colors and positions of 4 unimportant lights provided as uniforms, per-pixel shading can be achieved easily too. So why is it saying that "4 point lights are calculated per-vertex".
But now I think I have figured it out since I read the source code of unity standard shader. In both UnityStandardCoreForward.cginc and UnityStandardCoreForwardSimple.cginc, Shade4PointLights is called in vertex shader.
May be "4 point lights are calculated per-vertex" is just the truth of Unity's standard shading model, rather than a rule of any custom forward rendering model.

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
avatar image
0

Answer by JonPQ · Jul 08, 2020 at 05:36 PM

@kechen00 for "unimportant" it means that it will only do the lighting per vertex... it will use all 4 lights, and the normals from the corner vertices of each triangle. 3 calculations for a triangle... and the 3 color result will be interpolated across the whole of the triangle.

for per-pixel lighting, it means it will use those same 4 lights, but do the lighting calculations on every pixel, instead of every vertex. It interpolates the normals across all pixels rather than color, its slower, but even without normal maps, it will look better, it will pick up hi-lights for specular lighting much better, and you'll get less vertex lighting artifacts ( where you can see the shape of the triangles ) it also allows the use of a normal map ( again, even slower, but even nicer looking ), to change the normal vector for every pixel ( which is not possible for per vertex lighting )

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

131 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 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 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 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 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 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 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 avatar image avatar image avatar image avatar image avatar image

Related Questions

Forward Rendering costs 50 FPS 0 Answers

Forward Rendering not render on mobile 0 Answers

Pitch black shadow on sertain meshes in forward rendering 1 Answer

Can I have 2 different rendering paths: deferred and forward in the same scene? 1 Answer

Lightprobes on Vertex-lit rendering path 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