Supporting new/custom geometry

Use this forum for discussions specifically related to the Krakatoa SR C++ API.
For discussion of topics applicable to both the C++ and Py APIs, please use the parent forum.
nicholas_yue
Posts: 31
Joined: Tue Sep 13, 2011 11:43 pm

Supporting new/custom geometry

Postby nicholas_yue » Sun Oct 13, 2013 1:55 am

Hi,

I come from a RenderMan/Arnold/Mantra background so this question is frame with those renderer as a point of reference.

If I wish to add support to Kraktatoa for some new/custom geometry, is there a concept of geometry procedural ?

I had a look at the example code and I can see that example04.cpp, one can build mesh from scratch for renderering.

If I only wish to extend the renderer associated with a current product/exporter for a given DCC (e.g. Maya), can I write some form of geometry procedural, without writing the whole exporter ? Something like geometry procedural for the old-skool renderer ;-)

Cheers

User avatar
benyaboy
Posts: 396
Joined: Mon Oct 09, 2006 12:21 pm
Location: New York City
Contact:

Re: Supporting new/custom geometry

Postby benyaboy » Tue Oct 15, 2013 8:48 am

No. Krakatoa is a point renderer, not a geometry renderer. You are responsible for converting everything into points. Triangle meshes are used for matte passes to cull and matte out pixels in the render. There are also some built-in functions for converting triangle meshes into points but you can do that yourself. If you want to go directly from nurbs to points, go right ahead.

As it is now, all points should be created at the initialization step. Any procedurally created points are cached in memory. Internally additional points might be created for depth-of-field, motion blur, and repopulation algorithms.

User avatar
Conrad Wiebe
Posts: 777
Joined: Wed Aug 15, 2007 12:24 pm
Location: Thinkbox Software

Re: Supporting new/custom geometry

Postby Conrad Wiebe » Tue Oct 15, 2013 5:12 pm

benyaboy is correct in that Krakatoa is a point-renderer. It does not render any geometry of any sort. The general way to do this is to render geometry in a 3rd party renderer (such as RenderMan), and particles in Krakatoa, then composite the two. Krakatoa is able to seamlessly blend with composited geometry. This tutorial is for KMX, but the same thing applies to SR:
http://www.thinkboxsoftware.com/krak-ma ... d-shadows/

I'm not entirely sure what you are requesting to do. Can you clarify:
-Do you what Krakatoa to render points during a RenderMan render? As in, write a RenderMan procedural that accesses Krakatoa's API?
-Do you want Krakatoa to render both points *and* geometry in a single image? So, similar to RenderMan, you would want to write a Krakatoa procedural that draws geometry inside a Krakatoa render?
Conrad Wiebe
Software Development Manager
Thinkbox Software

nicholas_yue
Posts: 31
Joined: Tue Sep 13, 2011 11:43 pm

Re: Supporting new/custom geometry

Postby nicholas_yue » Fri Oct 18, 2013 1:45 am

Putting aside other geometry and talking **only** about points.

Yes, I wish to know how to write a Krakatoa procedural for Krakatoa SR that draws/render points inside the Krakatoa renderer.

Where can I read up on the API and sample C++ code to do that ?

User avatar
Conrad Wiebe
Posts: 777
Joined: Wed Aug 15, 2007 12:24 pm
Location: Thinkbox Software

Re: Supporting new/custom geometry

Postby Conrad Wiebe » Fri Oct 18, 2013 1:48 pm

Ah, yes. Generating procedural particles for Krakatoa to render is done using the krakatoasr::particle_stream_interface API class. The API also includes an example that demonstrates how to use it.

The file "example03.cpp" that is included with the API defines a simple custom particle stream that generates random particles in a 1x1x1 cube. I believe you should be able to adapt that code to your requirements.

Is this what you are looking for? Is there something specifically you are trying to achieve? Let me know if you have any other questions.
Conrad Wiebe
Software Development Manager
Thinkbox Software

nicholas_yue
Posts: 31
Joined: Tue Sep 13, 2011 11:43 pm

Re: Supporting new/custom geometry

Postby nicholas_yue » Fri Oct 18, 2013 7:38 pm

Looking at example03.cpp, it is not clear if one should build an executable or shared library (for loading in KrakatoaSR).

Given a production pipeline that is using Krakatoa, how does one deploy the procedural ? How is the procedural loaded within KrakatoaSR ?

Using RenderMan/Arnold as a reference, one would write a procedural geometry DSO e.g. myformat.so

In the RenderMan/Arnold renderer, it can load the myformat.so (plus any arguments required) and inject geometry/particles as part of the render.

In the example03.cpp, it talks about camera/lights etc, I don't have those information, those are part of the rendering scene which is generated by the Karakatoa for Maya and other DCCs.

User avatar
Conrad Wiebe
Posts: 777
Joined: Wed Aug 15, 2007 12:24 pm
Location: Thinkbox Software

Re: Supporting new/custom geometry

Postby Conrad Wiebe » Fri Oct 18, 2013 8:14 pm

I think I understand what you are describing. I will try clarify what Krakatoa SR does.

Krakatoa SR is C++ library. The library exposes access to our renderer. Its input is a scene (user defined camera, lights, particles, etc.) and its output is a rendered image.

So, if you are familiar with the RenderMan C API. Krakatoa SR is exactly analogous to the RenderMan C API. When writing a C program, you can use RenderMan's API to define a scene, and produce a rendered image.

You can't write a Krakatoa procedural for RenderMan, in the same way you couldn't write a RenderMan procedural for Krakatoa. Both Krakatoa and RenderMan produce 2D rendered images as output, and the only way to combine the two outputs is through compositing.

This is what I think you're asking about (correct me if I'm wrong):
-You'd want a procedural for a 3rd party renderer that can draw Krakatoa particles directly within the other rendered image (no compositing required).

If that is the case, that is not possible with Krakatoa SR, as it produces output images. It is theoretically possible for us to adapt the API to work with specific 3rd party renderer's APIs in this way though. We have experimented with doing so within 3dsmax, since 3dsmax allows for raytraced volume plugins (Maya however does not). It was somewhat successful, but it was written as a voxel raytracer, and not the normal Krakatoa point-renderer.

I hope this clarified how Krakatoa SR works.
Conrad Wiebe
Software Development Manager
Thinkbox Software

nicholas_yue
Posts: 31
Joined: Tue Sep 13, 2011 11:43 pm

Re: Supporting new/custom geometry

Postby nicholas_yue » Sat Oct 19, 2013 4:30 am

Hi Conrad,

No. I want to write a Krakatoa procedural (shared library) that is loadable within Krakatoa :-)

It might not be possible by design, just want to confirm my understand.

I only mentioned RenderMan and Arnold for architecture/design reference, not as a need to combine them with Krakatoa.

Cheers

User avatar
Conrad Wiebe
Posts: 777
Joined: Wed Aug 15, 2007 12:24 pm
Location: Thinkbox Software

Re: Supporting new/custom geometry

Postby Conrad Wiebe » Tue Oct 22, 2013 8:12 pm

You can do this, however, Krakatoa itself is not an executable, It's a library. So generally you wouldn't use a separate shared library for your procedural, and instead, you would just included it in your program directly.

So technically, you could write a shared library procedural, and then link it in your C++ executable, but you wouldn't normally need to do so.

Normally, you would do it this way:
a) Start a C++ project of executable type. Link KrakatoaSR.lib, and include krakatoa_renderer.hpp. Call it mykrakatoa.exe, and copy the KrakatoaSR.dll into the same directory.
b) Create a krakatoa_renderer object, set the user input (Where would this user input come from in your case?) and call render().

Then, after that, if you wanted to write a procedural that generated particles, you would write it as part of the mykrakatoa.exe project, and not in a separate dll.

I can give you a sample if you're interested. What platform are you building for (gcc/visual studio 9/10)? And is there any specific project you had in mind? I should be able to help you get started.
Conrad Wiebe
Software Development Manager
Thinkbox Software


Return to “Krakatoa SR C++ API”

Who is online

Users browsing this forum: No registered users and 2 guests