od[forum]: a shader each day - od[forum]

Jump to content

  • (8 Pages)
  • +
  • « First
  • 4
  • 5
  • 6
  • 7
  • 8
  • You cannot start a new topic
  • You cannot reply to this topic

a shader each day what it keeps away I don't know - but it can't hurt

#61 User is offline   rdg Icon

  • Houdini Master
  • PipPipPipPip
  • Group: Members
  • Posts: 548
  • Joined: 21-August 05
  • Gender:Male
  • Location:Vancouver, CA
  • Name:Georg
  • Duemlein

Posted 22 October 2008 - 05:43 AM

rdgSSS meets DLA:


Posted Image

http://medikalesha.d...et/skypeDLA.jpg

A 4k version of the 8k original.
Georg Duemlein [www.preset.de]
<i>Certified Houdini Instructor</i>
0

#62 User is offline   rdg Icon

  • Houdini Master
  • PipPipPipPip
  • Group: Members
  • Posts: 548
  • Joined: 21-August 05
  • Gender:Male
  • Location:Vancouver, CA
  • Name:Georg
  • Duemlein

Posted 24 October 2008 - 04:49 AM

Day 16: there comes the light

This one is a light shader.

Posted Image

Animated version

The light expands from the point source.
A use might be some strange explosions of even more strange weapons.
Currently it's rather uncontrollable - I need to dig more into the light shading to understand it.
For example I need to control the spread in units to be able to link any secondary effect to the light.
Like for example destruction of stuff inside the radius of the explosion.

I guess this might look also good inside some volume.
Georg Duemlein [www.preset.de]
<i>Certified Houdini Instructor</i>
0

#63 User is offline   Andz Icon

  • Houdini Master
  • PipPipPipPip
  • Group: Members
  • Posts: 639
  • Joined: 28-March 05
  • Location:Curitiba - Brazil
  • Name:Anderson
  • Baptista

Posted 24 October 2008 - 05:26 AM

Out of control, but still good looking. :ph34r:

Reminded me animations from this special relativity ray tracer (mpeg's at the bottom of the page)
Andz
My blog
0

#64 User is offline   rdg Icon

  • Houdini Master
  • PipPipPipPip
  • Group: Members
  • Posts: 548
  • Joined: 21-August 05
  • Gender:Male
  • Location:Vancouver, CA
  • Name:Georg
  • Duemlein

Posted 25 October 2008 - 08:03 AM

Day 17: The Shadows

Posted Image

Animation: http://vimeo.com/2063377

I added a shadow shader that only casts shadows outside the range of the light.
As this looked rather odd I also changed the light to behave like an occluded ambient light inside the radius.
At least what I understood this to be after reading the Rob's ambient light [1] thread again.

It's far more controllable by now, but still opens a lot of questions.
I did some post-processing to accent the shadows, they are quite faint in the beauty pass:

Posted Image

It's quite hard to rely on real world references in this case and I guess this is what it looks like ...
More likely there is an error in the shaders.

Anyway: What did I learn?
Why people use compositing packages instead of writing light/shadow shaders isn't a that big question anymore.

[1] http://forums.odforc...l=ambient+light
Georg Duemlein [www.preset.de]
<i>Certified Houdini Instructor</i>
0

#65 User is offline   rdg Icon

  • Houdini Master
  • PipPipPipPip
  • Group: Members
  • Posts: 548
  • Joined: 21-August 05
  • Gender:Male
  • Location:Vancouver, CA
  • Name:Georg
  • Duemlein

Posted 26 October 2008 - 02:06 AM

Day 18: Deep Color

While converting a Technicolor HLSL Shader [1] into a VOP COP2 Filter I remembered that Houdini also supports OGL2 shaders in the viewport.
The possibility to have a OGL2/Mantra combo that allows WYSIWG tweaking of shaders in the viewport was just too tempting.

As a first candidate I chose another shader of desaxismundi[2]: deepcolor[3].

Posted Image

It basically normalizes Pz from a user defined range to blend two colors. It also has a roll off/gamma control to tweak it.
It looked so easy and turned out to be a true adventure ...

Houdini Help said:

Before you can create an OpenGL shader you need to understand GLSL and its related concepts such as vertex shaders and fragment shaders.


Slowly my rudimentary openGL/GLSL/HLSL knowledge returned and I even managed to transform the fragment into camera space, before loosing my temper.
Evolution follows plagiarism and I added some outline controls.
The VEX Shader also supports an occlusion layer, but for some reason the shader just refuses to bind the controls:

Houdini Console said:

WARNING[rdg_ogl2_deepcolor]: Failed to bind variable 'switch_occlusion'


To function properly the shader needs be assign to a geometry that has UVs assigned. Preferably something like Rows&Columns.
Maybe there is a way to utilise something like s and t in GSLS - I have to investigate this.

Attached File  rdg_ogl2_deepcolor.tar.gz (149.56K)
Number of downloads: 150

This file contains a sample scene, the SHOP OTL and a gallery.
You need to copy the *.gal file into your HOUDNI_GALLERY_PATH - eg: ~/houdini9.5/gallery
The OTL goes into your HOUDINI_OTLSCAN_PATH - eg: ~/houdini9.5/otls

My help currently just dumps core information as soon as I try to display a custom OTL help ... so no much help when pressing F1.

[1] vvvv.org is currently inaccessible ... so no deep link
[2] http://desaxismundi.blogspot.com/
[3] vvvv.org is currently inaccessible ... so no deep link
Georg Duemlein [www.preset.de]
<i>Certified Houdini Instructor</i>
0

#66 User is offline   zasid Icon

  • Illusionist
  • PipPipPip
  • Group: Members
  • Posts: 279
  • Joined: 01-July 07

Posted 26 October 2008 - 05:51 AM

its looks very nice cool job!
Showreel Link :http://www.vimeo.com/1306044
0

#67 User is offline   rdg Icon

  • Houdini Master
  • PipPipPipPip
  • Group: Members
  • Posts: 548
  • Joined: 21-August 05
  • Gender:Male
  • Location:Vancouver, CA
  • Name:Georg
  • Duemlein

Posted 27 October 2008 - 09:24 AM

Day 19: Spherical Harmonics pythonSOP

Spherical Harmonics as described at Paul Bourke's site [1]
Symek: I still don't know what to do with them but eyecandy <_<

These turned out to be quite Haeckel-esque.

Posted Image

I guess it's time to de-dust the A3 printer.

The pythonSOP first creates all needed points and then connects them to polygons using the createPolygon method.
Get's slow at higher resolutions, but the development was more rapid than me trying to write another HDK massaker.

[1] http://local.wasp.uw...try/sphericalh/

This post has been edited by rdg: 28 October 2008 - 12:52 AM

Georg Duemlein [www.preset.de]
<i>Certified Houdini Instructor</i>
0

#68 User is offline   eetu Icon

  • Initiate
  • PipPip
  • Group: Members
  • Posts: 223
  • Joined: 30-May 07
  • Location:Helsinki, Finland
  • Name:e
  • m

Posted 27 October 2008 - 09:49 AM

Gorgeous!

You are doing interesting things, mister :)

eetu.
A shitty theory is better than no theory at all
0

#69 User is offline   rdg Icon

  • Houdini Master
  • PipPipPipPip
  • Group: Members
  • Posts: 548
  • Joined: 21-August 05
  • Gender:Male
  • Location:Vancouver, CA
  • Name:Georg
  • Duemlein

Posted 29 October 2008 - 05:51 AM

Day 20: Behind the scenes of "Art Forms of the Procedure: The Harmonic Atlas"

This one is rather dry - some unstructured notes on the progress.
I am working on a book called "Art Forms of the Procedure: The Harmonic Atlas" - a homage to Haeckel's master piece [1]

I set up a mantraROP-compositeROP to create the images for the book.
So far so good, but the chaining didn't work ... the support hopefully addresses the non-cooking of the geometry.
In the meantime I worked on the further pipeline.

I generate a fair number of rendering of spherical harmonics, just like this:

Posted Image

This is right after the composition.

The idea is now to store the parameters that generated that geometry in a machine readable way.
This allows applications further down the pipeline to access them and place them e.g. in the captions.

How to approach this?
A pre/post-render script for some reason refused to cook the right frame/parameter ... maybe this is part of the chaining issue .... <_<
But this is what SOHO was made for, isn't it?

What do we need?
1: A Database
I started writing per frame XML files but noticed that I am too lazy to parse them later - so I went for the whole menu.
A MySQL server and we are fine ...

2: A custom ROP
This allows to modularise the approach and separates style and content.

And there we go.

The database needs some table to store the data - in this case 8 parameters called M0 ... M7 and the current frame.

#!/usr/bin/env python
import MySQLdb

# connect to MySQL DB
conn = MySQLdb.connect (host = "localhost",
						   user = "root",
						   passwd = "",
						   db = "preset")
cursor = conn.cursor()

query = """ CREATE TABLE `preset`.`sphericalHarmonics` (
`id` INT NOT NULL AUTO_INCREMENT PRIMARY KEY ,
`M0` SMALLINT NOT NULL DEFAULT '0',
`M1` SMALLINT NOT NULL DEFAULT '0',
`M2` SMALLINT NOT NULL DEFAULT '0',
`M3` SMALLINT NOT NULL DEFAULT '0',
`M4` SMALLINT NOT NULL DEFAULT '0',
`M5` SMALLINT NOT NULL DEFAULT '0',
`M6` SMALLINT NOT NULL DEFAULT '0',
`M7` SMALLINT NOT NULL DEFAULT '0',
`frame` INT NOT NULL DEFAULT '0'
) ENGINE = MYISAM """

try:
	cursor.execute(query)
except:
	print "Table already exists.\nSkipping."


Next we create OutputdriverHDA using the file menu. Throught the Edit Render Parameters interface we add the parameters:
soho_program
soho_diskfile
soho_command
soho_outputmode


Some styling until it looks like this:

Posted Image

The ROP expects a path to a sphericalHarmonics pythonSOP.
Depending on the output mode it either creates a XML file or writes directly into the database.


The soho program looks like this and needs to be in the HOUDINI_SOHO_PATH:
# Produced by:
# 	Georg Duemlein
#	http://www.preset.de/
#
# 	Prints parameters of Spherical Harmonics to XML file ...
#


import soho
from soho import SohoParm
import hou
import time


controlParameters = {
	"now":SohoParm("state:time",		"real",   [0],  False, key="now"),
	"mode":SohoParm("soho_outputmode",	"int",	[0],	False, key="mode"),
	'harmonic'  : SohoParm('harmonic_path', 'string', ['/obj/geo_setzkasten/rdg_sphericalharmonics1'], False, key="harmonic")
	
}

parmlist = soho.evaluate(controlParameters)

FrameTime = parmlist["now"].Value[0]
mode = parmlist["mode"].Value[0]
harmonic = parmlist["harmonic"].Value[0]


if not soho.initialize(FrameTime):
	print "-1"
else:
	item = hou.node(harmonic)
	
	
	if mode == 1:
		print "<generic>"
	
	# output NULL for autoincrement
	if mode == 1:
		print "\t<id>NULL</id>s"
	else:
		print "NULL"
	
	
	# output the parameters
	for i in range(0, 8):
		parmvalue = str(item.parm("m" + str(i)).eval())
		if mode == 1:
			print "\t<ident id='%s'>%s</id>" % (i, parmvalue)
		else:
			print parmvalue
	
	# generate and outout current frame Number
	# mark (http://www.sidefx.com/index.php?option=com_forum&Itemid=172&page=viewtopic&t=11061&highlight=soho+frame)
	now = soho.getDefaultedFloat('state:time', [0])[0]   # Get the time that the ROP evaluation time
	FPS = soho.getDefaultedFloat('$FPS', [24])[0]		# Evaluate the $FPS variable
	frame = int(round(now * FPS + 1))					# Compute the frame number
	if mode == 1:
		print "\t<frame>%s</frame>" % (frame)
	else:
		print frame
	
	if mode == 1:
		print "</generic>"


If we don't want to save into the database that's all we need.
The ROP saves a per frame XML file with a content similar to this:

<generic>
	<id>NULL</id>s
	<ident id='0'>8</id>
	<ident id='1'>0</id>
	<ident id='2'>5</id>
	<ident id='3'>2</id>
	<ident id='4'>3</id>
	<ident id='5'>5</id>
	<ident id='6'>2</id>
	<ident id='7'>4</id>
	<frame>1</frame>
</generic>


The database is accessed through the soho_pipecmd.
The file needs to be placed somewhere in the path or referenced with an existing path prefex.
It also needs to be executable:
chmod a+x ./mapper


The data is "piped" into the command, not passed as arguments as I first expected.
It just collects everything into a list and passes this data to the database.
If there is an error accessing the database it returns an error value: 1: Cannot connect to DB or 2: Some Error in the query

#!/usr/bin/env python

# Georg Duemlein
# http://www.preset.de
# SOHO_pipecmd to store stuff in a database

import sys
import MySQLdb

content = []
for line in sys.stdin:
 	content.append(line.strip())

if content[0] == '-1':
	print "No Harmonics SOP specified.\nSkipping."
else:

	data = ", ".join(map(str, content))

	try:
		conn = MySQLdb.connect (host = "localhost",
							   user = "root",
							   passwd = "",
							   db = "preset")
	except:
		sys.exit(1)
	
	
	cursor = conn.cursor()
	query = "INSERT INTO sphericalHarmonics () VALUES (" + data + ")"
	try:
		cursor.execute(query)
	except:
		sys.exit(2)


I everything is going well, the database get rapidly filled with numbers:

Posted Image

I am not sure if there is a need for transactions in a farm context.

Anyway - the funny part is actually doing something with this data, like sorting and/or analysing and feeding it into InDesign or even directly into a PDF writer.

That's it - I am still looking for some feature film experience
I wouldn't mind working on commercials, though. But I appreciate that this is print.

[1] http://www.amazon.co...s/dp/3791333275

This post has been edited by rdg: 29 October 2008 - 06:04 AM

Georg Duemlein [www.preset.de]
<i>Certified Houdini Instructor</i>
0

#70 User is offline   pclaes Icon

  • Initiate
  • PipPipPip
  • Group: Members
  • Posts: 410
  • Joined: 07-October 06
  • Gender:Male
  • Location:Cinesite, London
  • Name:Peter
  • Claes

Posted 29 October 2008 - 04:42 PM

Really cool work ! This thread is always an interesting read !

I'm experimenting with Clifford Attractors myself at the moment :). Using prman 14 which has a python api. I'm using ripoints to render 10 million points through a renderman procedural (inline seems to be the only way it works without bound errors).

Paul Burke site on Clifford attractors:
http://local.wasp.uw...actals/clifford

I attached one of the images. I modified the formula to work in 3d. It's a shame they are a bit unstable when changing the control parameters drastically. I would have loved to interpolate between two attractors, but they collapse into a couple of points. At the moment I'm adding some additional noise to the points with the python cgkit module.

thanks for sharing the info! I'll probably put my own script online as soon as I clean it up and finish it :).

Attached thumbnail(s)

  • Attached Image

0

#71 User is offline   rdg Icon

  • Houdini Master
  • PipPipPipPip
  • Group: Members
  • Posts: 548
  • Joined: 21-August 05
  • Gender:Male
  • Location:Vancouver, CA
  • Name:Georg
  • Duemlein

Posted 29 October 2008 - 11:37 PM

View Postpclaes, on Oct 30 2008, 01:42 AM, said:

Using prman 14 which has a python api.

This is cheating <_<

Quote

I attached one of the images. I modified the formula to work in 3d. It's a shame they are a bit unstable when changing the control parameters drastically.


This is a feature not a bug, though.
As I get it these algorithms are searching for stable attractors - by classifying them through their Lyapunov exponent [1].
There for one would need first find some stable attractors, then sort them by some other attribute to interpolate them.
Probably you'd even need to recreate them afterwards to handle point orders and positions.

Another - more realistic - approach would be to rotate the attractor while attracting:
Like in parameter VI by W:Blut [2]


[1] http://en.wikipedia....apunov_exponent
[2] http://www.wblut.com/parameterVI.php
Georg Duemlein [www.preset.de]
<i>Certified Houdini Instructor</i>
0

#72 User is offline   SYmek Icon

  • Grand Master
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,045
  • Joined: 02-November 04
  • Location:Waw/Pol

Posted 30 October 2008 - 01:23 AM

View Postrdg, on Oct 30 2008, 08:37 AM, said:

This is cheating <_<



This is a feature not a bug, though.
As I get it these algorithms are searching for stable attractors - by classifying them through their Lyapunov exponent [1].
There for one would need first find some stable attractors, then sort them by some other attribute to interpolate them.
Probably you'd even need to recreate them afterwards to handle point orders and positions.

Another - more realistic - approach would be to rotate the attractor while attracting:
Like in parameter VI by W:Blut [2]


[1] http://en.wikipedia....apunov_exponent
[2] http://www.wblut.com/parameterVI.php


How prman createas 10milion rpoints via python API (or C API)? Technically in which moment of rendering pipeline these points are created? Does PRMan source a file and creates them in memory at once just before rendering? Rib is(AFAIK) one-to-one mapping of api method, right? So sequence goes like: create object (bounds), for() loop creating millions of points, then WorldEnd()? Just curious about memory management in PRMan workflow and how this can be mapped into Houdini/Mantra.

Normally most tricks with rib filtering and such are pointless in case of Houdini->mantra workflow, but here memory is always a constrain.
thinking loudly...
(...) It was late, late in the evening, the lovers they were gone;
The clocks had ceased their chiming, and the deep river ran on.
0

  • (8 Pages)
  • +
  • « First
  • 4
  • 5
  • 6
  • 7
  • 8
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users