AWS Thinkbox Discussion Forums

PRT Loader : SDK question

This question is a bit off topic, but related to the PRT Loader so I’m posting it here.

I’m developing an SDK plugin that needs to display small points in the viewport.

In the MarkerType enum for GraphicsWindow::marker (the typical point-drawing method for the viewport) there’s a POINT_MRKR value for drawing small dots (the docs say this should draw single pixels). However, when I call the function with that value, the points drawn to the viewport are actually tiny 4-pixel boxes.

In the PRT Loader, when set to “Display as Small Dots”, the points are displayed correctly as single pixels.

Is it possible for someone on the dev team to describe how they managed to get single pixels to draw? Thanks!

Hi. I think SM_DOT_MRKR will most likely draw the points the way you want.

Hmm, SM_DOT_MRKR gives the same result as DOT_MRKR, both of which are a 4x4 pixel dot.

I’ve cycled through all the values in the marker enum and none give just a single pixel, which is why I was wondering how Thinkbox did it…

Looking at our code, we switch between POINT_MRKR and SM_DOT_MRKR for the PRT Loader display modes, like Evan suggested. All other PRT objects in Krakatoa (PRT Volume, PRT Surface etc.) use SM_DOT_MRKR by default which gives us the 4x4 large particles.

However, the graphics driver might interfere with this. Are you running the regular DirectX-based Nitrous drivers?

Weird…I don’t think it’s a graphics driver issue (I’m running normal Nitrous in max 2017) because PRT Loader displays the small 1-pixel size just fine.

Maybe you’re doing some kind of other marker initialization in the gw? Or using special render limits? A lot of the functions are undocumented so it’s hard to tell what’s what.

My POINT_MRKRs are 2x2 when drawing with gw->marker, as well as when using the MarkerBuffer.

Something weirder…it seems like PRT Loader viewport particles scale with their viewport?

I noticed if I set my PRT Loader to large dots, and then scale the size of the active view on the screen, the dots scale with the view (from 4x4 down to 1pixel), despite other objects’ markers staying the same size (like supersprays and other particle systems) no matter how big their viewport is.

Perhaps the reason for this is part of why small PRT dots are displaying correctly as 1-pixel in size as well?

Oh right, now I remembered…

Krakatoa MX in 3dsMax 2015 and higher now uses a custom vertex shader for points drawing. I would have to check the exact reason, but basically the new Nitrous required us to rewrite how we draw points in Krakatoa and Stoke MX, and it allows us to control the size of the points freely (but we only allow that in Stoke right now). So large particles are drawn as rectangular sprites with user-defined size, and require separate handling of perspective and orthographic displays. Small particles are drawn by a single vertex with .size of 4.0f. The large particles have vertex size 0.0f, but 4 corners in a triStream to build the polygon…

The point drawing using a custom shader is orders of magnitude faster, so it was worth it. I am not sure what exactly was changed in Nitrous in v2015, but I believe it was unavoidable to go with a custom shader…

You can find the shader’s source under C:\Program Files\Thinkbox\Krakatoa MX\Shaders

Ah thanks for that! Never used shaders before…time to learn!

Update: I’ve now got 10s of millions of particles rendering super fast at proper pixel sizes…thanks again for your help!

Privacy | Site terms | Cookie preferences