Great!

I think it probably is a good starting point. Try seeing what the shader result 
looks like by taking away the specular/ambient/diffusion one at a time in 
various combinations from the final gl_FragColor, and you'll get a good idea 
what each contributes to the final look.

I'd recommend taking a look at the lighting models presented in the Orange Book 
as a next step. I think many of those were included in the 10.5 developer 
examples for QC and possibly in 10.6/10.7 as well. I'm not sure if those 
examples are still available at the ADC or not.

Something that's a pretty simple thing to figure out, if you're up for a 
challenge, would be to program a falloff to dark with distance linearly, and 
then figure out how to make it a circular radius. This had the effect of making 
a simple "shadowy/dark" area outside of the area of interest. That could be 
done by itself or added into the code above. I think that was one of the first 
challenges I imposed on myself when learning about lighting. Once you go 
through making a falloff from eye distance vs. light distance and seeing the 
differing results, you'll have had to think about some fundamental aspects of 
lighting all the way through.


On May 10, 2013, at 2:22 PM, Achim Breidenbach <[email protected]> wrote:

> George,
> 
> thank you for your solution, that is exactly what I am looking for! At a 
> first glance the comparison between left and right looks pretty good. It may 
> also be a good starting point to learn about lighting because your code 
> doesn't look to complicated.
> 
> best,
> 
> Achim Breidenbach
> Boinx Software Ltd.
> 
> 
> On 10.05.2013, at 07:32, George Toledo wrote:
> 
>> <Lighting with GLSL Shader (gt).qtz>
>> 
>> 
>> It's a late hour over here and it's possible I made some small mistake… but 
>> I think it should be OK and do the job. 
>> 
>> This is a Blinn-Phong lighting in GLSL, which is the standard OpenGL 
>> pipeline lighting. I'm only receiving one light (what the lighting 
>> environment is set to right now), so to receive more light values and create 
>> the correct lighting, the code will need to be modified. 
>> 
>> The principals can obviously be used to create fancier effects.
>> 
>> -George Toledo
>> 
>> On May 10, 2013, at 12:55 AM, Achim Breidenbach <[email protected]> wrote:
>> 
>>> Hi George,
>>> 
>>> thanks for the infos. Do you have a sample code? How could this be applied 
>>> to my sample composition?
>>> 
>>> I don't have any experience with lighting calculations in shaders yet. I 
>>> don't want to dive deep into materials and such, but simply want to have 
>>> the left cube look the same way as the right cube.
>>> 
>>> Achim Breidenbach
>>> Boinx Software Ltd.
>>> 
>>> 
>>> On 10.05.2013, at 06:47, George Toledo wrote:
>>> 
>>>> The reason you don't get a lighting effect is because applying a lighting 
>>>> environment is equivalent to using GL_LIGHTING related methods.
>>>> 
>>>> Attaching a shader to a mesh makes the shader program produce the 
>>>> material. At that point, any OpenGL lighting methods no longer influence 
>>>> the material, but they are still valid. What one does is to reference 
>>>> GL_LIGHT0 through 8, and GL_DIFFUSE, etc, to receive the values into your 
>>>> shader as variables. 
>>>> 
>>>> That way you can have many meshes with different shaders, creating various 
>>>> different material effects while sending info "globally" from OpenGL 
>>>> lighting. You wouldn't want the stock OpenGL lighting to simply be applied 
>>>> on top of a shader anyway since it's per vertex. Using glsl in conjunction 
>>>> with the lighting environment you can get best of both worlds.
>>>> 
>>>> On May 10, 2013, at 12:29 AM, Achim Breidenbach <[email protected]> wrote:
>>>> 
>>>>> Hi list,
>>>>> 
>>>>> in the attached composition I have two cubes rendered within a Lighting 
>>>>> patch. The right one is rendered natively and the left one is rendered 
>>>>> within a GLSL Shader patch. The lighting isn't applied to the GLSL one. 
>>>>> 
>>>>> What do I have to do to apply the lighting of a Lighting patch to 
>>>>> something rendered within a GLSL Shader patch?
>>>>> 
>>>>> Thanks!
>>>>> 
>>>>> Achim Breidenbach
>>>>> Boinx Software Ltd.
>>>>> 
>>>>> <Lighting with GLSL Shader.qtz>
>>>>> _______________________________________________
>>>>> Do not post admin requests to the list. They will be ignored.
>>>>> Quartzcomposer-dev mailing list      ([email protected])
>>>>> Help/Unsubscribe/Update your Subscription:
>>>>> https://lists.apple.com/mailman/options/quartzcomposer-dev/gtoledo3%40gmail.com
>>>>> 
>>>>> This email sent to [email protected]
> 

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Quartzcomposer-dev mailing list      ([email protected])
Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/quartzcomposer-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to