Shader tests

General questions about Indigo, the scene format, rendering etc...
Big Fan
Posts: 745
Joined: Tue Oct 17, 2006 9:37 am
Location: Nelson NZ

Post by Big Fan » Tue Aug 12, 2008 7:02 pm

it would be cool to declare textures and shaders globally (keeping using the index thing) instead into a material,
God give me a break I only just did the index thing I dont need it redone already :evil:

How about we are just happy with what we have for a while
Too much more of this stuff and people burn out with exporter updating :roll:

Plenty of other things could get attention without getting convoluted in shaders - reminds of the tropical sea water adventure :)

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 7:58 pm

okay, heres some colored gradient, im on a mac right now, so no chance to test it(maybe someone wants to give it a try?):

edit: they dont seem to work :)
edit: now they do
edit:dont work as expected, forget it :)

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 9:05 pm

got it now: renders will follow soon:

Code: Select all

<albedo>
	<shader>
		<shader>
			<![CDATA[	
					
			# 2D colored gradient shader V

			def colorCalc(real x) vec3 :
				vec3(
					# color1 = red (0.75,0,0)
					# color2 = green (0,0.75,0)
					# compute color mix

					#  color1 \/                      color2 \/
					add(mul(0.75,x),mul(sub(1.0,x),0.00)),
					add(mul(0.00,x),mul(sub(1.0,x),0.75)),
					add(mul(0.00,x),mul(sub(1.0,x),0.00))
				)
						
			def eval(vec3 pos) vec3 :
					colorCalc(dotj(getTexCoords(0)))
			]]>
		</shader>
	</shader>
</albedo>
heres the z up gradient thingy with color:

Code: Select all

<albedo>
	<shader>
		<shader>
			<![CDATA[	
					
			# 3D colored gradient shader Z (up) with center = 0.5
			
			def colorCalc(real x) vec3 :
				vec3(
					# color1 = blue (0,0,0.75)
					# color2 = green (0,0.75,0)
					# compute color mix

					#  color1 \/                      color2 \/ 
					add(mul(0.00,x),mul(sub(1.0,x),0.00)),
					add(mul(0.00,x),mul(sub(1.0,x),0.75)),
					add(mul(0.75,x),mul(sub(1.0,x),0.00))
				)
						
			def eval(vec3 pos) vec3 :
					colorCalc(div(mod(add(dotk(pos),div(0.6,2.0)),0.6),0.6))
			]]>
		</shader>
	</shader>
</albedo>
edit: just notced there was some color clamping going on in the 3d gradient. fixed now
Attachments
8.png
8.png (495.21 KiB) Viewed 3138 times
7.png
7.png (447.66 KiB) Viewed 3145 times
Last edited by fused on Tue Aug 12, 2008 10:44 pm, edited 3 times in total.

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

Post by Deus » Tue Aug 12, 2008 10:38 pm

Still cool but useless images ;) Ill post something... (image shack messed image up bad)

Image

here i used a shader that looks like this:

Code: Select all

	<material>
		<name>land</name>
	      <diffuse>
  			<texture>
		            <uv_set>uv</uv_set>
		            <path>world.png</path>
				<exponent>1</exponent> 
			</texture> 

			<albedo>
				<shader>
					<shader>
						<![CDATA[	
						
						# This is a comment
						
						def eval( vec3 pos ) vec3 :
					               sample2DTextureVec3(
					                  0,
					                     add( 
						                     	mul( 
						                     		vec2(
						                     	  		mul( cos(mul(noise(pos), 6.28) ) ,fbm(pos,10) ),
						                     	  		mul( sin(mul(noise(pos), 6.28)) ,fbm(pos,10) ) 
						                     	  	     )
						                     	  , 0.001 )
						                     	,
						                     	getTexCoords(0)
					                     	)
					                  ) 
						]]>
					</shader>
				</shader>
			</albedo>
		</diffuse>
	</material>
It is used to preturb the texture coordinates slightly so I can get away with a much lower resolution for the ground without getting square looking patches. Look closely at the green patches on the beach. Looks pretty nice. Trees still looks like shit but I did reduce the beach "size" after suggestion from you guys :)

Oh while I am at it. Ono what is the ouput range of noise functions? 0-1? -1 - 1 ? 0-X? talking about noise/fbm

Cheers!

/ D

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

Post by zsouthboy » Wed Aug 13, 2008 2:56 am

I like how Deus casually posts something awesome, like it's no big deal.

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

Post by Borgleader » Wed Aug 13, 2008 4:07 am

zsouthboy wrote:I like how Deus casually posts something awesome, like it's no big deal.
+1

He is one letter away from Zeus...so I guess awesome is normal for him :lol: :roll:
benn hired a mercenary to kill my sig...

Lord of the Rings Junkie
Posts: 222
Joined: Fri Feb 23, 2007 4:38 pm

Post by Lord of the Rings Junkie » Wed Aug 13, 2008 4:45 am

OnoSendai wrote:Another test:

(Piccy of brushed metal sphere)
Looks good as a bump test, but the shading is far from anisotropic. :( A true anisotropic shader would be awesome. :)

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

Post by Deus » Wed Aug 13, 2008 5:18 am

Oh thanks. It depends on who you are. I cannot model an ordinary vase properly.. math and programming I can do in my sleep. I envy most of you guys in this forum for your artistic skills :)

If you wanna steal ...err use the shader yourself preturb textures more then increase the 0.001 parameter (its the pertubation distance)

User avatar
pixie
Indigo 100
Posts: 2332
Joined: Sat Dec 29, 2007 4:54 am
Location: Away from paradise
3D Software: Cinema 4D
Contact:

Post by pixie » Wed Aug 13, 2008 7:50 am

Borgleader wrote:
zsouthboy wrote:I like how Deus casually posts something awesome, like it's no big deal.
+1

He is one letter away from Zeus...so I guess awesome is normal for him :lol: :roll:
You might not know but Deus is* God... ;)

*is as in means

StompinTom
Indigo 100
Posts: 1828
Joined: Mon Sep 04, 2006 3:33 pm

Post by StompinTom » Wed Aug 13, 2008 12:02 pm

zsouthboy wrote:I like how Deus casually posts something awesome, like it's no big deal.
nah it really isnt a big deal. so 90s.

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

Post by CTZn » Wed Aug 13, 2008 3:26 pm

Lord of the Rings Junkie wrote:
OnoSendai wrote:Another test:

(Piccy of brushed metal sphere)
Looks good as a bump test, but the shading is far from anisotropic. :( A true anisotropic shader would be awesome. :)
If you mean an anisotropic shader like in biased renderes, I don't agree. Or, as far as I'm concerned, you are not looking after a realistic effect :)
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 » Wed Aug 13, 2008 6:28 pm

Deus wrote:Still cool but useless images ;) Ill post something...
whoa, thats 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 » Wed Aug 13, 2008 6:42 pm

some new output, trivial and not as cool as deus' but funky with displacement ;)

rendered as always by zomB

edit:

heres the mat:

Code: Select all

    <material>
        <name>shader</name>
        <diffuse>
            <albedo>
                <shader>
                    <shader>
                        <![CDATA[   
 
                        # 3D colored gradient shader Z (up) with center 
= 0.5
 
                        def colorCalc(real x) vec3 :
                            vec3(
                                # color1 = blue (0,0,0.75)
                                # color2 = green (0,0.75,0)
                                # compute color mix
 
                                #  color1 \/                      color2 \/
                                add(mul(0.00,x),mul(sub(1.0,x),0.00)),
                                add(mul(0.00,x),mul(sub(1.0,x),0.75)),
                                add(mul(0.75,x),mul(sub(1.0,x),0.00))
                            )
 
                        def eval(vec3 pos) vec3 :
                            colorCalc(div(mod(add(dotk(pos),div(0.1,2.0)),0.1),0.1))
                        ]]>
                    </shader>
                </shader>
            </albedo>
            <displacement>
                <shader>
                    <shader>
                        <![CDATA[   
 
                        # ~1/3pi sinus waves displacment U
 
                        def eval() real :
                            mul(sin(div(mod(doti(getTexCoords(0)),0.1),0.1)),20.0)
                        ]]>
                    </shader>
                </shader>
            </displacement>
        </diffuse>
    </material>
Attachments
im1218551660.png
im1218551660.png (375.8 KiB) Viewed 2940 times

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

Post by Deus » Thu Aug 14, 2008 12:38 am

That was cool :) 1.1.9?

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

Post by CTZn » Thu Aug 14, 2008 1:00 am

Wondering: let's consider two special, but practical cases:

I must use a given texture for whatever parameter, but:

Case A: the texture I have is of a too too low x-y resoulution,

Case B: the pixel depth in the texture is too low (ie 8bit for displacement)

Can you see, for both cases, a way to improve the textures (dithering, smoothing, whatever) ? Provided that we would have better precision in UV space than just texture space (better results with shader than by photogimping).

I hope I wasn't too unclear, just trying to be prgmatical :)

Already, thanks !
obsolete asset

Post Reply
223 posts

Who is online

Users browsing this forum: No registered users and 105 guests