Horrible n00b questions incoming, sorry. Using PicaVoxel with QB files from Qubicle

0
ChildGodOfTerminus posted this 30 May 2016

Hi there,

First question: I noticed that the newest version of PicaVoxel includes support for emissive shaders (glow in the dark, full bright even when not lit, etc).

How can I import my Qubicle stuff and then edit it to include light up voxels in Unity? Also, I'm assuming I need a PV volume for every Qubicle object I edit in this way, yeah? How expensive is it in performance terms to build an entire game level out of those objects? Saw I want to make a Diablo clone type of game where I use voxel chunks in place of tiles to construct the entire environment. Am I committing suicide here, or doable?

Thanks in advance!

17 Comments
Order By: Standard | Newest | Votes
1
GarethIW posted this 30 May 2016

Hi.

PicaVoxel includes a shader named "PicaVoxel PBR One-minus alpha emissive". What the shader does is turn any voxel whose colour has an alpha value of less than one (255) into an emissive colour, with the intensity being an inverse of the alpha value (0 alpha = most emissive).

You can then use the Unity bloom image effect on the camera to make emissive voxels glow.

As far as making a Diablo clone is concerned, I'd say it might be doable on high-end PCs. If I were going to do it, I would construct tiles of no more than 32x32x32 voxels to make up the environment. You would be limited by RAM, so I imagine you wouldn't be able to make as large maps as Diablo has, but you could start small and see how it goes.

0
ChildGodOfTerminus posted this 30 May 2016

Hi Gareth,

Thanks for the super fast reply!

So I just have to figure out how to change alpha for voxels in Qubicle... heh. (Actually I don't think this is possible? Use the PV editor then?)

My tiles are definitely 32x32x32, and my environments will be much smaller than the ones in D3. Hopefully it'll fly because I think this is going to save my project after an environment artist... kinda screwed me. For a lot of cash. Yeah.

Maybe I can use plain old Unity primitives and just dress them up with voxels where appropriate.

OK, thank you!!

1
GarethIW posted this 30 May 2016

Ah yes, I don't think either the .qb or .vox formats specify alpha values unless I'm mistaken, whereas PicaVoxel does. You can paint the voxels using PV, or if you've already set a colour in your models to use as emissive, you could write a simple editor script to set the alpha value for all voxels of that colour. Or even just add that in to the .qb importer script.

0
ChildGodOfTerminus posted this 30 May 2016

I need to watch your overview video on PV so I can understand how it all works. Right now I'm operating at extreme noob level. I can handle C# fine, but I don't know the libraries in Unity very well yet, so that script is out of my reach only for lack of knowing where the handles and calls are.

Thanks again!

0
ChildGodOfTerminus posted this 30 May 2016

OK, so... maybe I'm missing a step (sorry!)

I have a character voxel (head, body, two arms, and two legs as separate meshes parented to the same object) that I imported through PicaVoxel in the Create menu.

Then I select her head, click on "Start Editing" in the Volume Script component, then change the drop down above the editor toolbar to "Value", set the slider to about 50 or so, take the brush tool and click on the voxels that make up her eyes.

I've enabled HDR on the main camera, added the Bloom script as a component (set to Basic), and changed the shader on the character's head mesh to the PBR One-Minus alpha emissive one.

When I hit play on my game, no glow. The pixels are shaded according to the ambient light in the scene like normal.

What am I missing?

Sorry to be a pest. I really appreciate the help!

-Mark

0
ChildGodOfTerminus posted this 30 May 2016

OK so it looks like when I paint a value in the PV editor, it's not actually being applied. If I set alpha to zero and then use the brush tool while looking at values, the voxel will turn black when I click on it, but then back to a neutral grey (128, I think) when I click the next voxel. Then when I click "Stop Editing", not even the most recent, black voxel stays.

Is there a bug? is it because I'm working on an imported QB? Is there an Apply button I'm missing?

Thanks, sorry, and thanks. :)

0
ChildGodOfTerminus posted this 30 May 2016

OK something's up with my editor, which I think is probably causing the problem. I'm also unable to drag any of the box tools (whatever Unity editor tool is currently active is applied instead, meaning if I have the pan tool active, the scene view just gets dragged instead.)

I'm able to change the color of voxels individually, or add them, or delete them, but nothing I do seems to permanently affect the alpha value.

I'm on Unity 5.3.4 under OS X. Not sure how else to describe the issue.

Sorry for so many serial messages and thanks for the help so far. Still banging on this. :)

0
ChildGodOfTerminus posted this 30 May 2016

And, all right. If the pan tool is active, it screws with stuff. So I have learned to use the editor only when the translate tool is active in the Unity editor. This way drag functionality works, and my alpha channel changes stick, too!

Unfortunately... I'm still not getting emissive pixels even with the alpha cranked all the way down to 0. I have the Glow Amount on the PV alpha emissive shader at 100, but no dice.

Any hint on where to start troubleshooting?

Thanks again.

1
GarethIW posted this 30 May 2016

So you don't want to be in Value mode, that's the issue here I think.

When I talk about the alpha value, I mean the alpha of the colour, as set in the standard Unity colour palette.

The Value of a voxel (as painted when you set the drawing mode to Value) is a byte 0-255 value you can use in your game for whatever you might need. Examples would be to give voxels a "type", or to give a voxel a health value.

0
ChildGodOfTerminus posted this 30 May 2016

THAT'S the piece I was missing. Thank you so much for patiently reading my ramble, you just gave me a huge payoff when this finally worked!!

Thank you thank you thank you!!

enter image description here

0
ChildGodOfTerminus posted this 30 May 2016

Now... can I create animations which change voxel colors? Is that only possible in the frame-by-frame version or can I do it in the animator? Hehe.

I'll go do some more video viewing and reading.... ;-)

1
GarethIW posted this 30 May 2016

It would be more likely that you would animate colours with a shader maybe. If you change the RGB colour of a voxel at runtime, you have to recalculate the mesh which would be inefficient.

0
ChildGodOfTerminus posted this 30 May 2016

So carve out the parts of her that should change color as a separate mesh, then apply a different shader at runtime to change color?

1
GarethIW posted this 30 May 2016

Actually yes, that would be better. I actually do just that in my current game - have an all-white volume that represents the section of the overall modelt hat I want to colour swap. Then I just change the colour on the material at runtime.

0
ChildGodOfTerminus posted this 31 May 2016

So, one more question (sorry).

If I only use PicaVoxel to import Qubicle objects that need editing (alpha for glow, and my protag who's made of multiple meshes with pivot locations and relative positions all set up in Qubicle already, although there's probably a way to do this in Blender and I'm just a filthy noob), and import my other objects just as DAE or whatever, is that less of a performance hit? Are PicaVoxel imported objects more weighty because they include hooks for the PV editor and so on?

Last edited 31 May 2016

1
GarethIW posted this 31 May 2016

There's currently a slight processing time overhead due to the Update() method on the Frame script at runtime, but the patch that is currently awaiting approval will vastly improve that to the point where it should be negligible.

The bigger overhead would be the memory used to store the voxel array. If you're not planning on destroying or adding voxels at runtime then you should probably go for non-PicaVoxel objects.

You can use the Mesh-Only Copy button to make a copy of a volume with no scripts attached, but this is per-volume so you'd need to do that for each of the volumes imported on your QB hierarchy. Secondly, you could just disable the Volume, Frame and Chunk scripts on each of the volumes. Or, like you say, you could just import your static volumes as standard models.

0
ChildGodOfTerminus posted this 31 May 2016

Thank you for your help and patience especially since my questions range beyond PicaVoxel. :)

Yes for certain static background elements (most of my level geometry), I won't need to be able to destruct/contruct or modify voxels, so I'll just import those as standard meshes. The exploder feature and other features of PV will be great for more interactive elements, though.

Thank you!


Our 123 members have posted 454 times in 109 discussions