Basic ISL questions

General discussion about Indigo Materials - material requests, material developement, feedback, etc..
User avatar
Borgleader
Posts: 2149
Joined: Mon Jun 16, 2008 10:48 am

Basic ISL questions

Post by Borgleader » Tue Aug 09, 2011 11:58 am

Ok so for the scene I'm working on I need a rather specific "material" which I think is only possible using shaders, and since I've never actually written one before, well here I am

((Yes I did check the manual's examples))

Basically I'm looking to make an "atmosphere" type shader which I think would go something like
Pseudocode wrote: a = dot(normal, lightVector)
b = 1 - dot(normal, viewVector)
c = (1, 1, 1, 1)

return a*b*c;
or at least I think this should yield what I'm looking for, however I don't know if we have access to this type of information in ISL.

((Added a visual reference of what I'm going for))
Attachments
_Planet.jpg
Left: Simple diffuse, Right: Simple diffuse + "atmospheric shader"
benn hired a mercenary to kill my sig...

User avatar
galinette
1st Place Winner
Posts: 923
Joined: Sat Jan 09, 2010 1:39 am
Location: Nantes, France
Contact:

Re: Basic ISL questions

Post by galinette » Tue Aug 09, 2011 12:40 pm

It looks to me that you want to code a brdf and not a shader in the sense of indigo ( but in other domains such as direct3d or OpenGL one would call this a shader)
This is not possible actually with indigo as you cannot acces to light and eye vectors

It is not possible to write the brdf in isl, just the albedo which is quite different ( for instance, a lambertian diffuse material has an albedo which is independent of incoming and light vectors, while the brdf has a dot product form)

You may try minCosTheta()*(1-maxCosTheta()) * c
Or maxCostheta()*(1-minCostheta())*c

However, what do you want to do visually? From this it would be more easy to help

Etienne
Eclat-Digital Research
http://www.eclat-digital.com

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

Re: Basic ISL questions

Post by Borgleader » Tue Aug 09, 2011 12:45 pm

It may not be so obvious on the picture but basically the material/shader should be transparent where the normals are facing the camera and should gradually become opaque at the edges.
benn hired a mercenary to kill my sig...

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

Re: Basic ISL questions

Post by CTZn » Tue Aug 09, 2011 1:59 pm

it's called a rim shader (Google), visibly introduced by Matt Pharr :)

Quick googling:
Easily giving the rim effect mostly common to 3 point lighting in films. Gives you better artist control on your shader, without having to bombard your objects with so much light to give a simple rim effect.
Depending on the effect you are after you can try galinette's shader as a blend or emission parameter (not base emission). Not that I have tried it myself but it's very close from my experiments with velvet, I can guess where it is leading more or less.

Indeed, as a fake lighting effect it sounds a bit weird to port to Indigo... let's see where that brings you Borgleader !
obsolete asset

User avatar
Zom-B
1st Place 100
Posts: 4627
Joined: Tue Jul 04, 2006 4:18 pm
Location: ´'`\_(ò_Ó)_/´'`
Contact:

Re: Basic ISL questions

Post by Zom-B » Wed Aug 10, 2011 1:24 am

Actually a fresnel like shader like here?!: http://www.indigorenderer.com/forum/vie ... f=7&t=7505
(green / red teapod)
polygonmanufaktur.de

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

Re: Basic ISL questions

Post by Borgleader » Wed Aug 10, 2011 1:49 am

That might do the trick, I'll pursue both this one and the one galinette proposed. Or any other if someone else proposes another alternative.
benn hired a mercenary to kill my sig...

User avatar
galinette
1st Place Winner
Posts: 923
Joined: Sat Jan 09, 2010 1:39 am
Location: Nantes, France
Contact:

Re: Basic ISL questions

Post by galinette » Wed Aug 10, 2011 2:38 am

Borgleader wrote:It may not be so obvious on the picture but basically the material/shader should be transparent where the normals are facing the camera and should gradually become opaque at the edges.
Ok I got it. Ctzn, the idea here is not to fake it by making it an emitter, but more a semi transparent diffuser with falloff.
This is a diffuse material at grazing angles and a null material at normal incidence. It's absolutely not fake.
However, not possible to do it with Indigo without faking something, as this is clearly a custom brdf material. It would require additional coding of indigo.

The possible fake I can imagine will have one drawback : energy loss.

Do you want to model it as a separate sphere which is slightly larger than the planet sphere, or directly integrated in the planet surface material? In the second case it would not suffer of the energy loss problem but then you cannot use bump or phong on your surface or it will look weird.

In the first case, define a blend of null and diffuse with for instance 80% for the null. Then make an albedo shader equal to one of the above equations

Etienne
Eclat-Digital Research
http://www.eclat-digital.com

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

Re: Basic ISL questions

Post by CTZn » Wed Aug 10, 2011 3:00 am

Well, something between a rim shader and an x-ray shader I guess ?

Borgleader, you are in good hands with galinette ;)
obsolete asset

User avatar
Doug Armand
Indigo 100
Posts: 1033
Joined: Fri May 16, 2008 5:49 pm
Location: London UK

Re: Basic ISL questions

Post by Doug Armand » Wed Aug 10, 2011 3:19 am

CTZn wrote:Borgleader, you are in good hands with galinette ;)
Can I just say....and I by no means want to sound dismissive of the user help that is freely and generously offered on this forum but surely these kind of requests would be best served by being answered by one of Indigo's dev's?

Seriously who else best knows the software. I think more involvement by the development team in answering these kind of complicated/involved queries would be welcomed by all?

It is their software after all as well as this being the official Indigo forum.

It does seem sometimes that only major bugs or outstanding renders generate any kind of official response.

Just saying guys....
Doug

Doug Armand

User avatar
OnoSendai
Developer
Posts: 6158
Joined: Sat May 20, 2006 6:16 pm
Location: Newcastle upon Tyne, UK
Contact:

Re: Basic ISL questions

Post by OnoSendai » Wed Aug 10, 2011 3:24 am

Hi Doug,
Etienne really does know what he's talking about :)

User avatar
Doug Armand
Indigo 100
Posts: 1033
Joined: Fri May 16, 2008 5:49 pm
Location: London UK

Re: Basic ISL questions

Post by Doug Armand » Wed Aug 10, 2011 4:21 am

OnoSendai wrote:Hi Doug,
Etienne really does know what he's talking about :)
Lol I know he does. It just seems that a lot of queries, some quite technical, are just left to the community to answer. Thats all. Which is fine for the generic stuff.

But seriously though Ono - could you have answered that query by Borgleader? Because I know I couldn't have. And if you could - then why not post a simple how to?.
Doug

Doug Armand

User avatar
OnoSendai
Developer
Posts: 6158
Joined: Sat May 20, 2006 6:16 pm
Location: Newcastle upon Tyne, UK
Contact:

Re: Basic ISL questions

Post by OnoSendai » Wed Aug 10, 2011 4:40 am

Sure I could have. But instead, I was coding furiously :)

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

Re: Basic ISL questions

Post by StompinTom » Wed Aug 10, 2011 4:50 am

OnoSendai wrote:Sure I could have. But instead, I was coding furiously :)
And the sun rises over Glare offices, where the smell of coffee and melting keyboards wafts through the air.

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

Re: Basic ISL questions

Post by Borgleader » Wed Aug 10, 2011 10:13 am

galinette wrote: Do you want to model it as a separate sphere which is slightly larger than the planet sphere, or directly integrated in the planet surface material? In the second case it would not suffer of the energy loss problem but then you cannot use bump or phong on your surface or it will look weird.

In the first case, define a blend of null and diffuse with for instance 80% for the null. Then make an albedo shader equal to one of the above equations

Etienne
I want it on a separate model, because the final planet will in fact be 3 different layers: surface, clouds, atmosphere.
benn hired a mercenary to kill my sig...

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

Re: Basic ISL questions

Post by Borgleader » Wed Aug 10, 2011 2:53 pm

a) What range of values does maxCosTheta() take? (in the example it's maxTheta() but indigo spat out an error saying that didn't exist so I assumed it was maxCosTheta())

b) I started my tests with the rim shader approach and I wanted the progression to have a steeper curve. So I "cooked up" this function:

Code: Select all

1-((1-x^8))
You can see its graph here:
http://www.wolframalpha.com/input/?i=1-%28%281-x^8%29%29
Basically I was thinking of mapping the linear progression of theta to this by having maxCosTheta()'s value "be x". Is there a "power" function? or do i simply chain multiply maxCosTheta() x8 ?

P.S: The reason the link is in the code tag is because the ^ in it was messing up the url detection/highlighting and i couldn't get it to work in tags either.
benn hired a mercenary to kill my sig...

Post Reply
17 posts

Who is online

Users browsing this forum: Google [Bot] and 1 guest