Author Topic: What things are already available?  (Read 8973 times)

d3x0r

  • Jr. Member
  • **
  • Posts: 75
    • View Profile
What things are already available?
« on: October 18, 2014, 01:12:48 am »
Do you have something like 'the voxel in-line with the screen pos at a certain distance' sort of thing?  I found the add a block on right click, and extended it to do something silly like make a cluster of blocks in a relative direction... So it's pretty easy to set voxels in the world.

Is there something about the order to set voxels in so transparent textures work better?  When I used fiber optic, repeated, complex stepping had transparency issues, that the textures further back were rendered over the visible fronts...

Something like in space engineers, when you create a new ship, your first focus is at a fixed distance from you along the mouse ray.
-----
THe other feature I was thinking I'd like would be, the block next to an existing type of block that the mouse ray is passing through... I realize that if you were looking down a wall that many voxels in line would be valid... so again maybe at a distance from the cursor... use like ctrl or alt-scroll wheel to set the distance?  Maybe I don't want that... maybe I can just click on a point to begin pathing.... well see still need to know which side near that block the mouseray is going through...

Like if I start with a center block in space (give the player a zero-g jetpack something) was going to use a center block with 6 blocks around it also filled in as a base shape for a neuron, and use the 6 voxels around it as connecting points... then still in that place, to extend a line outwards from there; in space engineers creative you cyou can hold ctrl and when building it selects a line of blocks... it's only a valid line when the mouse ray passes through a block on that line... so in theory there's 6 lines that extend out from this central shape, that I want to extend out away from myself, so i can't see the face to add the block to...

olive

  • Administrator
  • Full Member
  • *****
  • Posts: 149
    • View Profile
Re: What things are already available?
« Reply #1 on: October 18, 2014, 04:26:54 am »
Do you have something like 'the voxel in-line with the screen pos at a certain distance' sort of thing?  I found the add a block on right click, and extended it to do something silly like make a cluster of blocks in a relative direction... So it's pretty easy to set voxels in the world.

Is there something about the order to set voxels in so transparent textures work better?  When I used fiber optic, repeated, complex stepping had transparency issues, that the textures further back were rendered over the visible fronts...

Something like in space engineers, when you create a new ship, your first focus is at a fixed distance from you along the mouse ray.
-----
THe other feature I was thinking I'd like would be, the block next to an existing type of block that the mouse ray is passing through... I realize that if you were looking down a wall that many voxels in line would be valid... so again maybe at a distance from the cursor... use like ctrl or alt-scroll wheel to set the distance?  Maybe I don't want that... maybe I can just click on a point to begin pathing.... well see still need to know which side near that block the mouseray is going through...

Like if I start with a center block in space (give the player a zero-g jetpack something) was going to use a center block with 6 blocks around it also filled in as a base shape for a neuron, and use the 6 voxels around it as connecting points... then still in that place, to extend a line outwards from there; in space engineers creative you cyou can hold ctrl and when building it selects a line of blocks... it's only a valid line when the mouse ray passes through a block on that line... so in theory there's 6 lines that extend out from this central shape, that I want to extend out away from myself, so i can't see the face to add the block to...

If we understand well, what you are looking for is the voxel "pointing" system. That's the ZVoxelWorld::RayCast_Vector() function. Give it a point on the space, a direction vector and it will tell you the next "pointable" voxel in the line.
The game itself use it in ZRender_Basic.cpp at line 517. Parameters are initialized in lines above.
The algorithm use a kind of ray casting algorithm. We don't know if the parameters are explicit enough. Tell us if you need some info.

About transparency problems with some elements, there isn't a simple and definitive solution... but there is some possible workarounds to avoid them. In one word, the order in which voxels are set doesn't matter.

Let's explaining :

In Blackvoxel rendering, the polygons aren't sorted by distance before rendering. That would have been way too slow to do this on Blackvoxel because this game need VERY heavy rendering refresh activity.
So, we choose what we think is the best compromise on this particular game and it's particular needs... but the method isn't perfect.

Other games with different paradigms and goals can have made different technical choice to fit their particular needs. Blackvoxel rendering engine is strongly tied by the exigence of very fast refresh and rendering with an huge voxel grid universe. And so we had to do some technical choices for speed.

But we also implemented algorithms to mitigate these problems the much we can without costing too much machine power : Sectors rendering is sorted by distance and transparent voxels are rendered on a separate pass after "non transparent" rendering. There is also an alternate rendering path for some zones.

The problem remains between transparent voxels themselves.

That's where there is some requirement to design transparent texture that made them "blend well" despite unsorted rendering.
  • Semi transparent textures should be uniform (like transparent glass).
  • Different level of semi transparency should not be used on the same voxel (but you could use full opaque and transparent at the same time).
  • No semi transparent and opaque on the same voxel
  • Textures with transparent zones and opaque zones (like leaves) must have no zone with semi transparency
So, it look like we have to redesign the optical fiber texture.  :o

About the voxel selection algorithm, it was designed for the actual game. But you could change it for doing what you need. The raycasting algorithm we talk above can tell you what side of the voxel is pointed and some other useful informations. And you can also implement some kind of "space pointing" not tied on the fact one voxel is existing, simply by pointing a voxel at some distance. The ZRender_Basic::Render_VoxelSelector() function can also help you as it's the rendering of the "selection lines".

The Blackvoxel Team

d3x0r

  • Jr. Member
  • **
  • Posts: 75
    • View Profile
Re: What things are already available?
« Reply #2 on: October 18, 2014, 05:20:35 am »
So overlapping textures is a known issue :)  The fire texture did the same thing...