Shader tests

General questions about Indigo, the scene format, rendering etc...
Post Reply
223 posts
User avatar
CTZn
Posts: 7240
Joined: Thu Nov 16, 2006 4:34 pm
Location: Paris, France

Post by CTZn » Tue Jul 29, 2008 10:20 am

It sure looks great !
obsolete asset

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

Post by Borgleader » Tue Jul 29, 2008 11:11 am

CTZn wrote:It sure looks great !
+1

And...how do you....map a procedural? I mean, in the 3d editor, how do you map the fbm?
benn hired a mercenary to kill my sig...

User avatar
Grimm
Posts: 119
Joined: Sun Dec 09, 2007 7:38 pm
Location: Fairbanks, Alaska, USA

Post by Grimm » Tue Jul 29, 2008 11:51 am

Borgleader wrote: And...how do you....map a procedural? I mean, in the 3d editor, how do you map the fbm?
I'm not exactly sure what you mean by "map" the fbm, but I will take a stab at it. :) Fbm's are just random noise so you don't really know what you are getting until you render an image. You can adjust the texture by either scaling or translating the terms you feed into the fbm. This has the effect of resizing or moving the fbm and the resultant textures on the mesh. I hope this helps.
Last edited by Grimm on Tue Jul 29, 2008 11:58 am, edited 1 time in total.
Grimm

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

Post by Big Fan » Tue Jul 29, 2008 11:54 am

that brushed look is very nice ono

I think I will build that shader and vector direction into the specular reflectivity exporter settings just for that - very handy for Solidworks materials...

the previous egg shell/dimpled look is nice too - might borrow that as well

keep the examples coming 8)

EDIT:ok done that now when is 1.1.8 coming so I can try it? :lol:

User avatar
eman7613
Posts: 597
Joined: Sat Sep 16, 2006 2:52 pm

Post by eman7613 » Tue Jul 29, 2008 5:07 pm

OnoSendai wrote:
eman7613 wrote:i do belive the syntax would benifit greatly from operators :lol: :shock:

for anyone used to coding in java's horrid bigdecimal *raises hand*, this looks very familure :roll:
That's what you get for using a language without operator overloading (Java) :)
its my one complaint, but its okay, i made my own*

*j/k its just a math parser
Yes i know, my spelling sucks

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

Post by Kram1032 » Mon Aug 04, 2008 12:45 am

Grimm wrote:@Kram - Thanks, this has been a challenge that's for sure. :) Is this test more to your liking?
Yeah, those two last ones are great :D
First is pretty boneish and second pretty marblish :D


Anisotrophy :D Cool!

User avatar
fused
Developer
Posts: 3648
Joined: Fri Sep 22, 2006 7:19 am
Location: Berlin, Germany
3D Software: Cinema 4D

Post by fused » Tue Aug 12, 2008 2:13 am

ok,,, its hard to compete with such impressive shaders,,,

here are two very simple (you see, very very simple) gradient shaders, hope someone will find them useful:

Code: Select all

<albedo>
	<shader>
		<shader>
			<![CDATA[	
					
			# 2D gradient shader U
						
			def eval(vec3 pos) vec3 :
				vec3(
					doti(getTexCoords(0))
				)
			]]>
		</shader>
	</shader>
</albedo>

<albedo>
	<shader>
		<shader>
			<![CDATA[	
					
			# 2D gradient shader V
						
			def eval(vec3 pos) vec3 :
				vec3(
					dotj(getTexCoords(0))
				)
			]]>
		</shader>
	</shader>
</albedo>
thnaks to zomb for rendering!
Attachments
1.png
1.png (806.07 KiB) Viewed 3172 times
2.png
2.png (847.83 KiB) Viewed 3172 times
Last edited by fused on Tue Aug 12, 2008 6:57 pm, edited 1 time in total.

User avatar
fused
Developer
Posts: 3648
Joined: Fri Sep 22, 2006 7:19 am
Location: Berlin, Germany
3D Software: Cinema 4D

Post by fused » Tue Aug 12, 2008 2:49 am

3d gradient in z direction this time. a tiny bit more complex.

guess this can be quite useful :)

Code: Select all

<albedo>
	<shader>
		<shader>
			<![CDATA[	
					
			# 3D gradient shader Z (up)
						
			def eval(vec3 pos) vec3 :
				vec3(
					div(mod(dotk(pos),0.6),0.6)
				)
			]]>
		</shader>
	</shader>
</albedo>

<albedo>
	<shader>
		<shader>
			<![CDATA[	
					
			# 3D gradient shader Z (up) with center = 0.5
						
			def eval(vec3 pos) vec3 :
				vec3(
					div(mod(add(dotk(pos),div(0.6,2.0)),0.6),0.6)
				)
			]]>
		</shader>
	</shader>
</albedo>
again, thanks to zomb for rendering.
Attachments
5.png
5.png (842.64 KiB) Viewed 3158 times
6.png
6.png (861.91 KiB) Viewed 3158 times
Last edited by fused on Tue Aug 12, 2008 6:57 pm, edited 1 time in total.

User avatar
CTZn
Posts: 7240
Joined: Thu Nov 16, 2006 4:34 pm
Location: Paris, France

Post by CTZn » Tue Aug 12, 2008 2:58 am

Still cryptic but very usefull, fused, plz keep them coming !
obsolete asset

User avatar
cpfresh
Posts: 501
Joined: Thu Jun 14, 2007 12:20 pm
Location: California, USA
Contact:

Post by cpfresh » Tue Aug 12, 2008 9:20 am

the z up gradient is awesome, thanks for sharing fused!

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

Post by Whaat » Tue Aug 12, 2008 9:56 am

thanks for sharing this. It is useful to know what works. I have had lots of problems getting shaders to work.

Deus
Posts: 336
Joined: Sun Feb 04, 2007 3:47 am

Post by Deus » Tue Aug 12, 2008 12:04 pm

To be honest its pretty simple (if you can program to start with)

Anyone know if you can declare variables yet? I mean performance AND readability would increase tremendously

Compare:

Code: Select all

<albedo>
   <shader>
      <shader>
         <![CDATA[   
               
         # 3D gradient shader Z (up) with center = 0.5
                  
         def eval(vec3 pos) vec3 :
            vec3(
               div(mod(add(dotk(pos),div(0.6,2.0)),0.6),0.6),
               div(mod(add(dotk(pos),div(0.6,2.0)),0.6),0.6),
               div(mod(add(dotk(pos),div(0.6,2.0)),0.6),0.6)
            )
         ]]>
      </shader>
   </shader>
</albedo>
to:

Code: Select all


<albedo>
   <shader>
      <shader>
         <![CDATA[   
               
         # 3D gradient shader Z (up) with center = 0.5
                  
         def eval(vec3 pos) vec3 :
            float color = div(mod(add(dotk(pos),div(0.6,2.0)),0.6),0.6)
            vec3( color, color, color )
         ]]>
      </shader>
   </shader>
</albedo>
And why the Double shader tags? Nesting gone nuts tbh

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

Post by OnoSendai » Tue Aug 12, 2008 12:14 pm

No, you can't declare variables.
However you could factor out the colour computation into another procedure.
Actually, in this case, you can use the scalar vec3 constructor vec3(real x) vec3.

The double shader tags are there to draw a distinction between the type, and value of the albedo material parameter.

User avatar
CTZn
Posts: 7240
Joined: Thu Nov 16, 2006 4:34 pm
Location: Paris, France

Post by CTZn » Tue Aug 12, 2008 12:40 pm

it would be cool to declare textures and shaders globally (keeping using the index thing) instead into a material, so they can be called by any of them while delared once only. Maybe this could apply for constant definitions too ?

This idea comes along with the one of a database for constant maybe, and shaders, and with manual coding of shaders. It does not make much sense in regard with the generic scene exporting process.
obsolete asset

User avatar
fused
Developer
Posts: 3648
Joined: Fri Sep 22, 2006 7:19 am
Location: Berlin, Germany
3D Software: Cinema 4D

Post by fused » Tue Aug 12, 2008 6:48 pm

OnoSendai wrote:Actually, in this case, you can use the scalar vec3 constructor vec3(real x) vec3.
i have completely overlooked it! :o (edited the shaders now using this)
Deus wrote:To be honest its pretty simple (if you can program to start with)
ahhh thanks? i told you so :)


@ono:
can you give me a quick example on how if() works? how can i, for example check if a value is > 1?

Post Reply
223 posts

Who is online

Users browsing this forum: Bing [Bot], DotBot [Bot] and 28 guests