Shader tests

General questions about Indigo, the scene format, rendering etc...
Post Reply
223 posts
User avatar
OnoSendai
Developer
Posts: 6241
Joined: Sat May 20, 2006 6:16 pm
Location: Wellington, NZ
Contact:

Shader tests

Post by OnoSendai » Tue Jun 24, 2008 6:44 am

Hi all,

Well, when i should have been fixing bugs, adding long-requested features, and replying to emails, I've instead been working on a shader language for Indigo!

*begs forgiveness from exporter writers*

The language is a simple little strongly typed, pure functional language.
It's currently interpreted by a stack-based bytecode VM I hacked up.

I looked around at a few existing languages / VMs, but none of them provided quite what i wanted, or had too much overhead, so I decided to roll my own. Perhaps I'll switch to an existing language later, we'll see.

So here's an example shader used on a diffuse material:

Code: Select all

	<material>
		<name>mat1</name>
		<diffuse>
			<colour>0.7 0.7 0.7</colour>


			<albedo_texture>
				<uv_set>albedo</uv_set>
				<path>colorchecker_srgb_from_ref.jpg</path>
				<exponent>2.2</exponent>
			</albedo_texture>
			
	
			<albedo_shader>
				<![CDATA[
				
				def rgbAlbedo(vec3 pos, vec2 uv) vec3 :
					sample2DTextureVec3(
						0,
						add(
							getTexCoords(0, uv),
							vec2(fbm(pos, 10))
							)
						)
							
				]]>
			</albedo_shader>
		</diffuse>
	</material>
And the result:
http://fatalfantasy6.deviantart.com/art ... 2-89539933

It uses a fractal Brownian motion function to perturb the texture coordinates. (good for making procedural marble :) )

You will be able to write shaders for any material parameter, also for displacement.

Thoughts, ideas, requests, etc..?

User avatar
PureSpider
Posts: 1459
Joined: Tue Apr 08, 2008 9:37 am
Location: Karlsruhe, BW, Germany
Contact:

Post by PureSpider » Tue Jun 24, 2008 7:01 am

/me hears Ono's mama yelling: "NICK! GET BACK TO WORK! NOW!"
:D
Unfair advantage as we can't upload such pictures to deviantART :P

User avatar
Borgleader
Posts: 2149
Joined: Mon Jun 16, 2008 10:48 am

Post by Borgleader » Tue Jun 24, 2008 7:32 am

Damn I want to see it but Im at work and deviant art is blocked :( Oh well I'll have to wait 'till I'm home (in 3 hours). Sounds like a great feature to look forward to though

User avatar
zsouthboy
Posts: 1395
Joined: Fri Oct 13, 2006 5:12 am

Post by zsouthboy » Tue Jun 24, 2008 8:35 am

Ono, you're killing us here, slowly but surely :P

I'm guessing that translating [3d modeller of choice]'s procedurals into the shader language will be fun. (but very powerful)

User avatar
Kram1032
Posts: 6649
Joined: Tue Jan 23, 2007 3:55 am
Location: Austria near Vienna

Post by Kram1032 » Tue Jun 24, 2008 8:40 am

O.o Great!




are you FatalFantasy6?

User avatar
OnoSendai
Developer
Posts: 6241
Joined: Sat May 20, 2006 6:16 pm
Location: Wellington, NZ
Contact:

Post by OnoSendai » Tue Jun 24, 2008 8:41 am

Yup, that's my deviant art page.

User avatar
Kram1032
Posts: 6649
Joined: Tue Jan 23, 2007 3:55 am
Location: Austria near Vienna

Post by Kram1032 » Tue Jun 24, 2008 8:42 am

ok, adding :)

User avatar
psor
1st Place Winner
Posts: 1295
Joined: Sun Jun 25, 2006 1:25 am
Location: Berlin
Contact:

Post by psor » Tue Jun 24, 2008 8:43 am

Just awesome! :shock: 8) :wink:
"The sleeper must awaken"

User avatar
Whaat
Developer
Posts: 1827
Joined: Fri Dec 22, 2006 6:15 am
Location: Canada
Contact:

Post by Whaat » Tue Jun 24, 2008 9:24 am

can someone explain what you mean by 'shader'? Does it basically mean that you define material attributes using mathematical functions? Like user customized procedurals?

neepneep
Indigo 100
Posts: 413
Joined: Wed Jun 28, 2006 10:21 am

Post by neepneep » Tue Jun 24, 2008 10:07 am

whoaa ... its as if indigo licked the back of a hallucingenic toad :shock:

User avatar
dougal2
Developer
Posts: 2532
Joined: Wed Nov 15, 2006 8:17 am
Location: South London

Post by dougal2 » Tue Jun 24, 2008 10:30 am

oh fuck.

User avatar
OnoSendai
Developer
Posts: 6241
Joined: Sat May 20, 2006 6:16 pm
Location: Wellington, NZ
Contact:

Post by OnoSendai » Tue Jun 24, 2008 10:47 am

Whaat wrote:can someone explain what you mean by 'shader'? Does it basically mean that you define material attributes using mathematical functions? Like user customized procedurals?
Yup, basically you embed a short program in the scene file, that describes the albedo, exponent, blend factor, displacement, etc.. of any material.
The program is executed whenever a ray hits the material, and can therefore use such information as the normal at the hit position, hit position, surface uv coordinates at the hit position etc.. to calculate the final colour or whatever.

The shaders will be a bit more limited than renderman shaders (which more or less the industry standard for non-realtime rendering), as I want to keep the physical plausibility and unbiased properties of Indigo. (in renderman you can do any kind of unphysical shading). So therefore the function of the shaders will be limited to controlling parameters of the existing BRDFs implemented in Indigo (at least for now :) )

User avatar
rgigante
Posts: 326
Joined: Wed Jun 28, 2006 6:46 am
Location: Italy

Post by rgigante » Tue Jun 24, 2008 7:11 pm

Finally it is! That's a big step ahead compared to competitors!

Thanks for sharing.

User avatar
suvakas
3rd Place Winner
Posts: 2613
Joined: Mon Sep 04, 2006 11:08 pm
Location: Estonia
Contact:

Post by suvakas » Tue Jun 24, 2008 8:07 pm

Cool and complicated. 8)

Big Fan
Posts: 745
Joined: Tue Oct 17, 2006 9:37 am
Location: Nelson NZ

Post by Big Fan » Tue Jun 24, 2008 8:19 pm

when i should have...

*begs forgiveness from exporter writers*
not happy out here :?

Post Reply
223 posts

Who is online

Users browsing this forum: No registered users and 17 guests