Volume Shaders
Daniel <night-...@...>
Guys,
I just started looking into OSL. It certainly looks very interesting! Did I miss something or is it true that volume shaders are currently neither implemented, nor truly specified? I see that you filed issue #3 about this. Can you already comment on your plans for volume shaders? I'm curious... Which part of the illumination will the shaders actually compute? Regards, Daniel
|
|
Re: Compiling OpenShadingLanguage under Windows
"Pierre Saunier" <pierre...@...>
Dear all,
Isn't it possible to distribute the files produced by Flex and bison? Normally, they should be independant from the system (they are produced on and they are used on), and it will avoid a lot of trouble to build osl... And if someone wants to recreate them, it is always possible! When the doc about integrating OSL in an actual renderer will be available? At least some sample code? Regards, Pierre Great,_________________________________________________________ Mail sent using root eSolutions Webmailer - www.root.lu
|
|
Re: Compiling OpenShadingLanguage under Windows
Wormszer <worm...@...>
I agree, it was something I was going to suggest too after getting a windows version built and all the details worked out.
toggle quoted messageShow quoted text
Its seems overkill having to install cygwin to just be able to parse a couple of files when doing a checkout and straight build. Is anyone else trying to build OSL on windows besides Oleg and me? I have a feeling its not a very common target in the movie business or for the current set of users. Jeremy
On Wed, Jan 20, 2010 at 4:10 AM, Pierre Saunier <pierre...@...> wrote: Dear all,
|
|
Review: raylevel and isshadowray
Larry Gritz <l...@...>
http://codereview.appspot.com/186244
This is the OSL-side change. On the renderer side, you still need to set the fields in the ShaderGlobals correctly. -- Larry Gritz l...@...
|
|
Re: Compiling OpenShadingLanguage under Windows
Oleg <ode...@...>
Hi Jeremy,
Great,Yes, but I've solved them a bit different: just added export macros to the corresponding classes and "implemented" the "Symbol::mangled ()" method inline. Let me know how it works out for you.I didn't perform any tests so far. Regards, Oleg
|
|
Re: Compiling OpenShadingLanguage under Windows
Wormszer <worm...@...>
Hello Oleg,
toggle quoted messageShow quoted text
That's probably a better solution. Will need to go back and make sure the libraries export their classes rather than duplicating the source in the projects. I was trying to avoid adding to much to the code for windows, and I was planning on after hopefully to get it all building, to then do a clean checkout and do it again and make changes to submit as a patch. I played around some and finally got a shader to compile. I have a solution but its not very elegant. The compiler is hard coded to use linux CPP preprocessor. /usr/bin/CPP I was able to get it working using CL to do the pre-processing. But I had to write it to a file and read it back in rather than using stdout. Its only a few lines of code extra and passes the file handle from the opened file to the parser instead of the _popen handle. CL will output to stdout. When i was testing in in the debugger the issue was that by default the build environment is not setup. You typically have to run the vcvars32.bat to set it up and that was causing some issues. And then i am not positive if the stdout of CL parses correctly, it seems to insert the filename at the begining, but the file output does. So maybe we can figure out a better solution to get it working with cl using stdout. It may work if you run oslc from a command prompt with the vs variables setup already. I will try that next, except im expecting the process spawned by _popen won't have the environment setup correctly. And since it using stdout to read from then anything you do can't output or it gets parsed. If you mess with it the parameters to CL i used are /P /C /EP /X /nologo and then /FI to force the include file. Remove /P if you want stdout instead of file. Jeremy
On Wed, Jan 20, 2010 at 4:07 PM, Oleg <ode...@...> wrote: Hi Jeremy,
|
|
Re: Compiling OpenShadingLanguage under Windows
Oleg <ode...@...>
Nice debugging session... Thanks for the information :-)
toggle quoted messageShow quoted text
Did you try to use the "ShellExecute()" function? Does the "ShellExecute()" function setup the environment in the right way (or just not modify the existing one)? I will try to look into it in the next days. Oleg
On 20 Jan., 22:37, Wormszer <wo...@...> wrote:
Hello Oleg,
|
|
Re: Compiling OpenShadingLanguage under Windows
Chris Foster <chri...@...>
On Thu, Jan 21, 2010 at 7:37 AM, Wormszer <worm...@...> wrote:
I have a solution but its not very elegant. The compiler is hard coded toOver at aqsis, we use the C preprecessor from boost called boost.wave. It's been a good choice for us since it runs anywhere with a capable C++ compiler. The main annoyance with wave is that it causes the compiler to issue truly horrendous error messages if you get things wrong (the wave internals make heavy use of template metaprogramming). ~Chris.
|
|
Re: Compiling OpenShadingLanguage under Windows
Blair Zajac <bl...@...>
On 01/20/2010 03:11 PM, Chris Foster wrote:
On Thu, Jan 21, 2010 at 7:37 AM, Wormszer<worm...@...> wrote:There's mcpp which is designed to be an embeddable C-preprocessor.I have a solution but its not very elegant. The compiler is hard coded toOver at aqsis, we use the C preprecessor from boost called boost.wave. It's Ice, which we use at Sony Imageworks for all our middle-tier systems, uses mcpp for it's own internal IDL type language, so I would recommend that. Regards, Blair
|
|
Re: Compiling OpenShadingLanguage under Windows
Chris Foster <chri...@...>
On Thu, Jan 21, 2010 at 11:02 AM, Blair Zajac <bl...@...> wrote:
(Obviously this is only a problem when integrating wave into the projectThe main annoyance with wave is that it causes the compiler to issue truly source, and that's not really difficult at all.) There's mcpp which is designed to be an embeddable C-preprocessor.mcpp looks nice. In some sense, using wave would mean one less dependency since OSL already relies on boost, but it does mean linking to libboost-wave, so if you have a modular boost install the point may be moot... ~Chris PS: Sorry to Blair for the duplicate message. I intended to send it to the list :-(
|
|
Re: Compiling OpenShadingLanguage under Windows
Wormszer <worm...@...>
I am fine with either one. I think having something embedded or buildable would be usefull.
toggle quoted messageShow quoted text
Otherwise there maybe issues with different compilers and would probably need some kind of config or something that cmake would generate at least on windows with several versions of VS etc. Will just have to see how Larry or the other devs feel about using one of those two for Linux builds as well. I would assume it would be wise to have all the preprocessing done with the same tool when possible. I will look at both real quick but I might lean towards mcpp.
On Jan 20, 2010, at 8:14 PM, Chris Foster <chri...@...> wrote:
On Thu, Jan 21, 2010 at 11:02 AM, Blair Zajac <bl...@...> wrote:(Obviously this is only a problem when integrating wave into the projectThe main annoyance with wave is that it causes the compiler to issue truly
|
|
Re: Compiling OpenShadingLanguage under Windows
Wormszer <worm...@...>
I have mcpp integrated into the compiler now. Working like CPP and writing everything to stdout. A few things, the binary available for download at least on windows doesn't support forcing an include file. So i had to build it from source, luckily it wasn't to difficult to create a new project for it. I built it as VS for VS. Now that I think about it I bet I could build it as VS for GCC so that it would support the same command line options. Another weird issue was I guess the lexer doesn't support c-style /* comments? These might not be defined in the osl language, and if so probably should be removed from the stdosl.h. Its the only difference i could see, that could of been causing the error. CL would remove the */ */ comments at the end of the math defines in stdosl.h even though i told it to preserve comments. mcpp when i told it to leave comments would actually leave them in there(seems like correct behavior), and then the lexer would crash. I am not sure why comments are needed really at this point, and i think i must of included them for my own debugging, i don't think CPP was set to output them. Thanks for the suggestions on a easier solution to the pre-processor issue. I looked real quick for the boost but mcpp seemed easier since i could just get a binary and set it in my path. (but then i had to rebuild it) Well now to see if I can get anything to happen with my compiled shaders. Jeremy
On Wed, Jan 20, 2010 at 9:03 PM, Wormszer <worm...@...> wrote: I am fine with either one. I think having something embedded or buildable would be usefull.
|
|
Re: Volume Shaders
Larry Gritz <l...@...>
We're tackling the volume shaders fairly soon. The spec isn't very clear about them, but that will be beefed up as we implement it. Basically the idea is that it will be very analogous to surface shaders -- returning a closure that describes in a view-independent way what the scattering of the volume is at a particular point. A "volume integrator" in the renderer is responsible for doing the actual ray marching, evaluating the closure for specific light directions, and accumulating the contributions along the viewing ray.
This will all get fleshed out over the next few weeks, there's a pretty strong near-term deadline on our own shows to get this working. -- lg On Jan 20, 2010, at 12:29 AM, Daniel wrote: Guys,-- Larry Gritz l...@...
|
|
Re: Volume Shaders
Daniel <night-...@...>
On 21 Jan., 08:33, Larry Gritz <l...@...> wrote:
A "volume integrator" in the renderer is responsible for doing the actual ray marching, evaluating the closure for specific light directions, and accumulating the contributions along the viewing ray.OK, that is how I interpreted the spec. The volume integrator will, presumably, need some information about the density of the volume, right? Do you already have ideas for specifying that in OSL? Or will volume density information simply be part of the scene description so integrators can choose to do this in a way that fits their scene format? Regards, Daniel
|
|
Re: Volume Shaders
Daniel <night-...@...>
On 21 Jan., 10:12, Daniel <night...@...> wrote:
Or will volume density information simply be part of the scene description so integrators can choose to do this in a way that fits their scene format?Meh, I just realized my ambiguous use of "integrator". In this case I meant "party integrating OSL into their system"... Regards, Daniel
|
|
Re: Volume Shaders
Larry Gritz <l...@...>
Er, I'm not sure. I think this is exactly the kind of thing we will be working out over the next few weeks. When we actually implemented surface integrators, we discovered all sorts of issues we hadn't realized when we spec'ed it. The gist is what we imagined, but the little details are different, I expect the same will happen with volumes.
The "density" is already part of the volume's closure, in much the same way that opacity is already part of a surface closure (by virtue of its weighting of closure elements that know they are "transparency-like"). It's possible that we'll want the shader to also return some kind of hint about the frequency that it needs to be sampled (as part of, or in addition to, the closure). Or maybe that's strictly the job of the integrator. The integrator can itself have parameters set by the renderer, and there can be multiple integrators for very different volume situations that need different sampling strategies. Also, it should be obvious that when we add volumes, we will also add several volume scattering closures, as the set of surface closures will not be adequate. Stay tuned, this will all be done very soon, and probably discussed in detail here as it's happening. -- lg On Jan 21, 2010, at 1:12 AM, Daniel wrote: On 21 Jan., 08:33, Larry Gritz <l...@...> wrote:-- Larry Gritz l...@...
|
|
Re: Volume Shaders
Daniel <night-...@...>
On 21 Jan., 16:13, Larry Gritz <l...@...> wrote:
Stay tuned, this will all be done very soon, and probably discussed in detail here as it's happening.Thanks so far for the answers, I'm looking forward to seeing OSL progress. Good stuff! Regards, Daniel
|
|
run flags vs active intervals
Chris Foster <chri...@...>
Hi all,
I've been looking through the OSL source a little, and I'm interested to see that you're using runflags for the SIMD state. I know that's a really conventional solution, but there's an alternative representation which I reckon is significantly faster, and I wondered if you considered it. Imagine a SIMD runstate as follows index: [ 0 1 2 3 4 5 6 7 8 9 ] flags: [ 0 0 1 1 1 1 0 0 1 0 ] An alternative to the flags is to represent this state as a list of active intervals. As a set of active start/stop pairs, the state looks like active = [ 2 6 8 9 ] ie, state: [ 0 0 1 1 1 1 0 0 1 0 ] ^ v ^ v 2 6 8 9 The advantage of doing this is that the inner SIMD loops become tighter since there's one less test. Instead of for (int i = 0; i < len; ++i) { if (state[i]) do_something(i); } we'd have for (int j = 0; j < nActiveTimes2; j+=2) { for (int i = active[j]; i < active[j+1]; ++i) do_something(i); } and the inner loop is now completely coherent. I can see you have the beginnings of this idea in the current OSL code, since you pass beginpoint and endpoint along with the runflags everywhere. However, why not take it to its logical conclusion? Given that you already have beginpoint and endpoint, the particularly big win here is when most of the flags are turned on. If do_something() is a simple arithmetic operation (eg, float addition) the difference between the two formulations can be a factor of two in speed. I'm attaching some basic test code which I whipped up. Timings on my core2 duo with gcc -O3 look like: All flags on (completely coherent): run flags: 1.310s active intervals: 0.690s Random flags on (completely incoherent): run flags: 5.440s active intervals: 3.310s Alternate flags on (maximum number of active intervals -> worst case): run flags: 1.500s active intervals: 2.150s Thoughts? ~Chris.
|
|
Re: run flags vs active intervals
Larry Gritz <l...@...>
Awesome, Chris. Would you believe we were just talking internally about this topic yesterday? We were considering the amount of waste if there were big gaps of "off" points in the middle. But I think your solution is quite a bit more elegant than what we were discussing (a list of "on" points). I like how it devolves into (begin,end] for the common case of all points on.
It's a pretty big overhaul, touches every shadeop and a lot of templates, and the call signatures have to be changed (to what, exactly? passing a std::vector<int>& ? or a combo of int *begend and int segments?). Ugh, and we may wish to change/add OIIO texture routines that take runflags, too. But your experiment is quite convincing. What does everybody else think? Chris/Cliff/Alex? (I'm happy to do the coding, but I want consensus because it touches so much.) -- lg On Jan 21, 2010, at 8:21 AM, Chris Foster wrote: Hi all,-- Larry Gritz l...@...
|
|
Re: run flags vs active intervals
Wormszer <worm...@...>
Is there a good resource on this topic? I did some googling and didn't see what i was looking for.
toggle quoted messageShow quoted text
Where is the actual SIMD taking place? Is the compiler figuring it out from the loop and setting up the correct instructions. Or is it relying on the cpu to recognize consecutive ops with different data, modifying instructions in its pipe by combing instructions into a parallel one. Or maybe i'm way off. Thanks, Jeremy
On Thu, Jan 21, 2010 at 12:16 PM, Larry Gritz <l...@...> wrote: Awesome, Chris. Would you believe we were just talking internally about this topic yesterday? We were considering the amount of waste if there were big gaps of "off" points in the middle. But I think your solution is quite a bit more elegant than what we were discussing (a list of "on" points). I like how it devolves into (begin,end] for the common case of all points on.
|
|