What is the difference betweel GLSL and OSL? #1
Replies: 6 comments
-
Hi - thanks for you question. I'm sorry that I didn't see it until just now. Shaders on shadertoy.com are all GLSL shader code. While GLSL and OSL are both shading languages, and as such share a number of concepts in common, they are designed with slightly different goals in mind. The biggest difference is that GLSL is strongly typed and has a multitude of different variable types, whereas OSL is loosely typed and has far fewer variable types. OSL is designed to be more like "c" and allows automatic type casting, whereas GLSL is a more low-level language designed to be closer to the machine instructions that run on a GPU. Another difference is that GLSL shaders are used in a GPU renderer that uses a different type of rendering process, whereas OSL is typically used in a Monte Carlo path tracing rendering system. My book would be a good place to get started. There is also the companion OSL shader code repository: https://github.com/mprater/ShaderWriting Good luck! mitch |
Beta Was this translation helpful? Give feedback.
-
Do you know anyone who could write me some OSL Shaders? I want to learn how to do it myself as well, I’ll just start with your book.
Thank you for the response by the way.
I want one that is just of an oscillating SIN Wave, like from a Laser Projector with a Time Parameter I can animate in C4D.
All the best,
K
From: Mitch Prater ***@***.***>
Sent: Wednesday, December 4, 2024 8:41 AM
To: LaikaStudios/OSLShaderWriting ***@***.***>
Cc: KingCrimson0666 ***@***.***>; Author ***@***.***>
Subject: Re: [LaikaStudios/OSLShaderWriting] What is the difference betweel GLSL and OSL? (Discussion #1)
Hi - thanks for you question. I'm sorry that I didn't see it until just now.
Shaders on shadertoy.com are all GLSL shader code. While GLSL and OSL are both shading languages, and as such share a number of concepts in common, they are designed with slightly different goals in mind. The biggest difference is that GLSL is strongly typed and has a multitude of different variable types, whereas OSL is loosely typed and has far fewer variable types. OSL is designed to be more like "c" and allows automatic type casting, whereas GLSL is a more low-level language designed to be closer to the machine instructions that run on a GPU.
Another difference is that GLSL shaders are used in a GPU renderer that uses a different type of rendering process, whereas OSL is typically used in a Monte Carlo path tracing rendering system.
My book would be a good place to get started. There is also the companion OSL shader code repository: https://github.com/mprater/ShaderWriting
Good luck! mitch
—
Reply to this email directly, view it on GitHub <#1 (comment)> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/ATI4KJKIB5BUWTCSMJTKF7T2D4WAJAVCNFSM6AAAAABOGQXL32VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCNBWGM3TGOA> .
You are receiving this because you authored the thread. <https://github.com/notifications/beacon/ATI4KJPJF6OLY4G2OSLDUO32D4WAJA5CNFSM6AAAAABOGQXL32WGG33NNVSW45C7OR4XAZNRIRUXGY3VONZWS33OINXW23LFNZ2KUY3PNVWWK3TUL5UWJTQAV3WDU.gif> Message ID: ***@***.*** ***@***.***> >
|
Beta Was this translation helpful? Give feedback.
-
It's interesting that you ask. I wanted to include an "oscilloscope" shading node in the book's chapter on shader debugging, but I ran out of time, so that's now on my to-do list for the second edition. Such a shader is useful for examining a function, and was used to produce some of the images in the chapter on modifying patterns. |
Beta Was this translation helpful? Give feedback.
-
This has me thinking about OSL a lot, and I have been using template ones to project shaders though a light. I was wondering though, how deep can OSL Shading go?
I’ve seen it be used as a Camera Lens and other stuff in this video. https://www.youtube.com/watch?v=jri7QnuZa7w
From the looks of it OSL can do anything I can imagine, but I have no idea how it gets there.
I want to learn it, but I have hardly coded anything so it may be a long arduous process.
K
From: Mitch Prater ***@***.***>
Sent: Friday, January 10, 2025 6:10 PM
To: LaikaStudios/OSLShaderWriting ***@***.***>
Cc: KingCrimson0666 ***@***.***>; Author ***@***.***>
Subject: Re: [LaikaStudios/OSLShaderWriting] What is the difference betweel GLSL and OSL? (Discussion #1)
It's interesting that you ask. I wanted to include an "oscilloscope" shading node in the book's chapter on shader debugging, but I ran out of time, so that's now on my to-do list for the second edition. Such a shader is useful for examining a function, and was used to produce some of the images in the chapter on modifying patterns.
I can't give you much help here, but you could try contacting http://www.lollipopshaders.com/ for any custom shader work.
—
Reply to this email directly, view it on GitHub <#1 (comment)> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/ATI4KJPOKMHH4Z45XE2NLTD2KB4Q3AVCNFSM6AAAAABOGQXL32VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCOBQGQYDIOI> .
You are receiving this because you authored the thread. <https://github.com/notifications/beacon/ATI4KJKB6227FCXLP4QCLBD2KB4Q3A5CNFSM6AAAAABOGQXL32WGG33NNVSW45C7OR4XAZNRIRUXGY3VONZWS33OINXW23LFNZ2KUY3PNVWWK3TUL5UWJTQAWQOZC.gif> Message ID: ***@***.*** ***@***.***> >
|
Beta Was this translation helpful? Give feedback.
-
OSL is nothing but a programming language. As such, it can be used for processing any kind of data for whatever purpose you like - it all depends on how it's been incorporated into an application. Typically, that application is a renderer, but could be any system. Building OSL into your own system is a monumental task if you're new to programming. The OSL repository has an example renderer and a shader network creation tool that use OSL, but these systems will be very hard to understand if you don't already have some experience with the operation of these types of systems. mitch |
Beta Was this translation helpful? Give feedback.
-
Hi Mitch,
Thanks for the interesting answers!
I reached out to Lollipop Shaders, and he is super busy with doing stuff for RenderMan and Nuke. I was wondering if you knew anyone else who can help me write shaders?
All the best,
K
From: Mitch Prater ***@***.***>
Sent: Monday, January 13, 2025 7:34 PM
To: LaikaStudios/OSLShaderWriting ***@***.***>
Cc: KingCrimson0666 ***@***.***>; Author ***@***.***>
Subject: Re: [LaikaStudios/OSLShaderWriting] What is the difference betweel GLSL and OSL? (Discussion #1)
OSL is nothing but a programming language. As such, it can be used for processing any kind of data for whatever purpose you like - it all depends on how it's been incorporated into an application. Typically, that application is a renderer, but could be any system.
Building OSL into your own system is a monumental task. The OSL repository has an example renderer and a shader network creation tool that use OSL. But it you're new to programming, these systems will be very hard to understand.
mitch
—
Reply to this email directly, view it on GitHub <#1 (comment)> , or unsubscribe <https://github.com/notifications/unsubscribe-auth/ATI4KJKBUUNANCFYAGP4BLL2KSATDAVCNFSM6AAAAABOGQXL32VHI2DSMVQWIX3LMV43URDJONRXK43TNFXW4Q3PNVWWK3TUHMYTCOBSG4YTOMQ> .
You are receiving this because you authored the thread. <https://github.com/notifications/beacon/ATI4KJNAXUHWSLERMKJ7TRD2KSATDA5CNFSM6AAAAABOGQXL32WGG33NNVSW45C7OR4XAZNRIRUXGY3VONZWS33OINXW23LFNZ2KUY3PNVWWK3TUL5UWJTQAWR36I.gif> Message ID: ***@***.*** ***@***.***> >
|
Beta Was this translation helpful? Give feedback.
-
I am in a late night rabbit hole about OSL. I got here through Google. I wish I went to Siggraph2024 so I could see your lecture.
Curious, I see lots of shaders on Shadertoy.com and I think they are written as GLSL, can you convert to OSL easily somehow? What is the difference? I am trying to make some shaders OSL so they are compatible with Octane. My knowledge on all of this is nonexistent. I'll probably read your book when it comes out! :)
Beta Was this translation helpful? Give feedback.
All reactions