User Tag List

Page 1 of 2 1 2 LastLast
Results 1 to 10 of 19

Thread: 3D Voxel Model Shader

  1. #1
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLC

    Join Date
    Jul 2008
    Location
    UK
    Posts
    1,553
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)

    3D Voxel Model Shader

    Just thought I'd share my latest DX11 pixel shader, made for displaying 3D voxel models in CF2.5, which also includes some basic directional lighting (look out for an updated voxel terrain shader, coming soon).



    Download: https://1drv.ms/u/s!Atq7cUIJ7uextF5X...5-2Xu?e=1ROUbq

    As always, feel free to share, modify or use it in any way you like.
    PS. Thanks to NaitorStudios for his recent help, which made this possible.

  2. #2
    Forum Moderator Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleFirefly 3D ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Mac Export Module (Steam)Universal Windows Platform Export Module (Steam)Firefly 3D Module (Steam)
    NaitorStudios's Avatar
    Join Date
    May 2010
    Location
    Brazil
    Posts
    1,613
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    Amazing!
    Curious if these will work right on other runtimes, I'll port as soon as I can

  3. #3
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLC

    Join Date
    Jul 2008
    Location
    UK
    Posts
    1,553
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)
    Yeah, I don't know the limitations of the other runtimes. Using DX11 definitely made me very lazy though, since it has so few limitations - there's definitely plenty of potential for more streamlining if needed.

    I'm wondering if I need to modify the shader to support multiple rows of images in a texture. My B24 Liberator model, which is not huge, still ends up with a texture almost 4000px wide (but far less tall), and in WebGL I believe the maximum texture size that's guaranteed to be supported by all hardware, is 4096 x 4096 pixels, so perhaps some other runtimes might have similar restrictions?

    EDIT: In fact, I just tried it again, and since the last changes I made to the shader, the B24 has started causing the app to just silently close on startup (it worked before)
    EDIT2: It turns out that isn't the problem - it just crashes any time I choose the texture using the file selector instead an expression with apppath$ + "filename.png". That's really weird...

  4. #4
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLC

    Join Date
    Jul 2008
    Location
    UK
    Posts
    1,553
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)
    Version 2 is out now:


    (100x100x100 cube!)

    The big change is that it now uses a two-dimensional grid of frames, rather than a single row, and you can specify which frames to use (allowing for easy animation).
    Other enhancements include a new fog/darkness system, the ability to set the centre of rotation (like the "hotspot" in Cf2.5) and the order of rotations.
    I've also included a very basic user guide.

    Download: https://1drv.ms/u/s!Atq7cUIJ7uextGB0...Yzk7w?e=x8rgd6

  5. #5
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export Module
    VBEinc's Avatar
    Join Date
    Oct 2015
    Posts
    986
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by MuddyMole View Post
    Version 2 is out now:
    How to install?
    I put the files into fusion but it doesn't show the plane.
    No issues starting at all, just no plane showing up.

    Thanks

  6. #6
    Forum Moderator Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleFirefly 3D ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Mac Export Module (Steam)Universal Windows Platform Export Module (Steam)Firefly 3D Module (Steam)
    NaitorStudios's Avatar
    Join Date
    May 2010
    Location
    Brazil
    Posts
    1,613
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    It only works on DX11, because DX9 shaders couldn't handle it...
    It could be backported but would need to be really simplified.

  7. #7
    Clicker Fusion 2.5 DeveloperAndroid Export ModuleiOS Export Module
    VBEinc's Avatar
    Join Date
    Oct 2015
    Posts
    986
    Mentioned
    12 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by NaitorStudios View Post
    It only works on DX11, because DX9 shaders couldn't handle it...
    It could be backported but would need to be really simplified.
    TY for the info!

  8. #8
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLC

    Join Date
    Jul 2008
    Location
    UK
    Posts
    1,553
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)
    I'm experimenting with making the voxels more like proper cubes. The results look quite nice, but performance has taken a big hit, so unless I can manage some serious optimisation, this may be a dead end...




  9. #9
    Forum Moderator Fusion 2.5 MacFusion 2.5 DeveloperFusion 2.5+ DLCAndroid Export ModuleHTML5 Export ModuleiOS Export ModuleFirefly 3D ModuleInstall Creator Pro
    Fusion 2.5 (Steam)Fusion 2.5 Developer (Steam)Fusion 2.5+ DLC (Steam)Android Export Module (Steam)HTML5 Export Module (Steam)iOS Export Module (Steam)Mac Export Module (Steam)Universal Windows Platform Export Module (Steam)Firefly 3D Module (Steam)
    NaitorStudios's Avatar
    Join Date
    May 2010
    Location
    Brazil
    Posts
    1,613
    Mentioned
    9 Post(s)
    Tagged
    0 Thread(s)
    That's incredible
    I love the subtle chamfer/bevel, kind of reminds me of Minecraft artwork
    Even if this performs badly, please let me have it xD

  10. #10
    Clicker Fusion 2.5 DeveloperFusion 2.5+ DLC

    Join Date
    Jul 2008
    Location
    UK
    Posts
    1,553
    Mentioned
    16 Post(s)
    Tagged
    0 Thread(s)
    There's not much to it really - in the getPixel function, right after where it says "int3 pos = round(position);" you simply divide "pos" by a scaling factor. I used 8 in those examples, so each cube is technically 8x8x8 voxels. And then you need to increase the number of loop iterations in the main function, because the maximum view distance is also reduced by a factor of 8 - and of course, that's what causes the performance to suffer.

    That example with the trees is actually quite a challenging scenario, since more than half of the view is sky, meaning that the loops are running to completion (500 iterations), rather than stopping early when the ray hits a solid object (if you tilt the camera down towards the ground a bit, it runs much faster). If used for a game with more confined spaces, I think performance could be very much better. I remember Sinclair Strange recreated the first level of Alien Trilogy using P3D, and that would be the perfect scenario - very confined spaces (including low ceilings), and a lot of darkness to limit the player's range of vision: https://youtu.be/FKrUEqdtR94?t=232

    In fact, I believe the original Playstation generally used a 320x240 display mode, and at that low resolution, I can already manage 60fps, so there's hope yet!
    I've also found heaps of ways to simplify and optimise the engine, which should help.

    The next part of the plan is to make that "3D tilemap" version I talked about, where each pixel on a map texture becomes a 16x16x16 (same as minecraft) volume of voxels. These cubes were actually the first step towards that. And then I'm going to try that "fake depth buffer" idea, so that voxel models or billboarded sprites can be used inside the voxel world! (though it won't be user-friendly)

Page 1 of 2 1 2 LastLast

Similar Threads

  1. Detect device model with "Model" expression
    By willy in forum iOS Export Module 2.5
    Replies: 4
    Last Post: 22nd February 2018, 01:43 PM
  2. 3D Voxel City
    By SolarB in forum File Archive
    Replies: 4
    Last Post: 4th December 2013, 06:19 AM
  3. Voxel extension? Mode 7 ex?
    By Sebaceous in forum Extension Development
    Replies: 3
    Last Post: 9th January 2010, 07:59 PM
  4. Voxel Style graphics
    By Atherton in forum Multimedia Fusion 2 - Technical Support
    Replies: 5
    Last Post: 4th May 2009, 02:20 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •