Krakatoa SR C++ API

Oh! This is something I haven’t seen yet. I’ll try to take a look at the issue as soon as I can.

Thanks for reporting this, and for the test scene!

Hi,

in maya we use the “horizontal film offset” in the camera settings for our stereo renderings. Is there a way to implement such a feature into the API?

Oh, and for the same reason we use the camera prescale. We render a larger frame to get some extra pixels to play with. With prescale, the field of view is automatically manipulated to that the original framing does not change.

Film offsets are implemented in the API, and will be in the next release.

As for camera pre-scale, would that not just be a function of FOV in you’re using the API?

Indeed, this can be done with fov. It’s only easier if it can be done in the api. But I can do the necessaray calculation in my plugin. This should be no problem. More important would be the horizontal image translation.

Would it be possible to implement a shadow casting per object attribute? We have some geometry which should only used as mask but not cast shadows.

Hi,

I try to use emission.
I do not have a per particle emission, only global emission.

use_emission(true); set_emission_strength(this->renderGlobals->mtk_EmissionStrength); set_emission_strength_exponent(this->renderGlobals->mtk_EmissionExponent);

In debug mode, I can see that the values are correct. But I cannot see any change in my rendered images.
Do I need a emission per particle value in this case?

In nuke we use a vector blur node to blur our images. This node uses screen space motion vectors, the same that are created by mentalray.

In krakatoa we get other vectors in the final image. I suppose they are defined in camera space? Or world space? Any chance to get screen space motion vectors?

You can do this by using triangle_mesh’s member function:
set_visible_to_lights( bool )

If you set that to false, the geometry will not cast shadows on the particles.

Yes, the default emission value is [0,0,0]. So when you turn it on, it will not look different by default. To get particles to emit a color, your particles must have an “Emission” channel, or you can set one manually. To force an “Emission” channel for particles that do not have emission, you can use:

krakatoasr::particle_stream myStream;
//setup myStream properly here.
krakatoasr::channelop_set_vector( myStream, "Emission", 1.0, 0.0, 0.0 ); //adds/sets the "Emission" channel to red [1,0,0]
//add this stream to the renderer

We have had many discussions about what kind of data we should output for the velocity pass. Currently the vectors are in camera-space, so to get pixel-space, it would need to be computed from the camera space vectors and the z-depth values. If it is needed, we could implement them in pixel-space though.

If you are doing this for the purpose of 2D motion blur, it may not be a good idea. Generally 2D vector motion blur in Krakatoa looks bad because of the volumetric nature of the renders. The per-pixel velocities that Krakatoa generates represent the velocity of the particle that is closest to the camera in that pixel, so unless your particles are rendering a rather solid object using particles, the 2D motion blur won’t really be acceptable.

I just posted a new build. The latest build adds screen-space offsets and fixes the memory leak bug that was reported earlier in this thread. More updates to come.

Cool! We’ll try it. Thanks a lot. I tried the channelop approach sucessfully with the “Absorption” channel.

krakatoasr::particle_stream ps = krakatoasr::particle_stream::create_from_particle_stream_interface(stream);
krakatoasr::channelop_set_vector( ps, "Emission", 10.0, 10.0, 10.0 );
krakatoasr::channelop_set_vector( ps, "Absorption", 1.0, 0.0, 0.0 ); 
add_particle_stream( ps );

Absorption in this case only works if the “use_absorption_color” is set to false. Is that correct?
Exact the same approach seems not to have any effect in the emission, turned on or not in the renderer. I can see in the output that the cannel is created. But I cannot see any difference in the rendering.

Seems I’m a bit confused with the channelop functions.

  • I have to create an appropriate channel in my particle stream.
  • Then the channelop_set_vector() and others work.
  • The appropriate attributes have to be turned on (e.g. use_absorption_color(true)).

If I understand the header file correctly, then if I use the channelop function, there should be no need to create the channel in the particle strem myself. I’ve tried it several times, but if I do not create the channels in the stream with append_channel(), then no channels are created as I can see in the renderer output.

Just played around with some density values and discovered a phenomenon I cannot explain.

My particles have a clear blue color [0.0, 0.0, 1.0]. Result is a blue rendering.
Now I set the particle color to [0.1, 0.1, 0.9], the result with a default particle density is white. If I reduce the particle density to 0.1, the result becomes blue again.

Seems I do not understand the procedure how krakatoa uses the density. Is it possible that the colors are clamped somehow?

I just made a quick test with a particle color of [0, 0, 20.0]. Shouldn’t this color make it into the final exr? There I have no values > 1.0.

Absorption should work in this case when “use_absorption_color” is set to true (it should not work if “use_absorption_color” is set to false). Is it not behaving this way?
It also should work the same way with emission, if you set an emission color with channelop_set_vector( ps, “Emission”, 10, 10, 10 ) and set “use_emission” to true. This should produce self-illuminated particles.

What I suspect is happening is that your lighting is forcing the r,g,b channels over the a value of 1.0, and thus it is appearing as white. By turning down the density, or turning down the light power should start to see a difference in the R, G, and B channels. Does that work?

You are correct, if you use channelop to set a channel, you do not need to declare that channel in your original stream. In fact, the channels you provide in your stream should have no affect on the channels in the final renderer.

So, to get an “Emission” channel in the final renderer, all you have to do is set use_emission_color to true. It will default to all black, so it won’t do anything, unless you set it with a channelop, etc.

If it has a light shining on it, then it should produce a blue particle in the image. If it has no lights hitting it, then it will be black (in that case you could use emission).

What I mean is:

If I have a light illuminating the particles, and I have a bright color, lets say [100.0, 100.0, 100.0] why do I get no values above 1.0 in my exr?