Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Lighting
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Lighting



Possibly not the right forum for this kind of query (if not, I apologise in advance), but someone may know the answer.


I have a GLSL shader that uses a simple Phong Directional lighting algorithm, with per-pixel illumination calculated in the Fragment shader. Lighting properties are based on the properties of gl_LightSource[0]. I've discovered I can nest the GLSL patch inside a Lighting macro patch and change light position, ambient color etc of the lightsource.


Just wondering; for this kind of basic lighting, is it best to let the Lighting patch handle all the lighting (ie remove all the lighting code from the GLSL patch)? Are there advantages, in terms of quality and efficiency, to writing lighting code in the shader, assuming we're not using any sort of fancy lighting effects?


Alternatively, would I be better off without the Lighting patch, and setting the light position, ambient color etc. manually inside the shader? I assume if I were to do this, I'd have calculate the halfVector in the shader also.




Cheers,


alx
http://machinesdontcare.wordpress.com




      __________________________________________________________
Sent from Yahoo! Mail.
The World's Favourite Email http://uk.docs.yahoo.com/nowyoucan.html
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.