Join us on Discord!
You can help CodeWalrus stay online by donating here.

X3D - A 3D engine for TI68k & Nspire Calculators

Started by catastropher, June 27, 2015, 02:37:43 AM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

catastropher

I've been working more on the "line texture" abilities; now it's possible to add more complex line-art to walls. This will allows for fairly detailed scenes using art that is made entirely of lines. I may be in the minority here, but I actually like the look of sold wireframe rendering - it feels really retro to me for some reason!

[spoiler=Line-art][/spoiler]

XBuilder has a simple line art editor now (though it kinda sucks because I implemented it all in one day). Making that aperture logo by hand with lines was really hard though XD
  • Calculators owned: TI-83+, TI-83+ SE, TI-84+ SE, TI-Nspire CX, TI-92+, TI-89 Titanium
Creator of X3D, a 3D portal rendering game engine for Nspire, 68k, and PC

Dream of Omnimaga

Wow I didn't know that kind of textures was possible. I assume you can assign them to each wall like with regular textures? I think this could be handy for writings and other effects.

Also can you mix both wireframe and textured mode? Someone could make a Celshading-like game like Zelda: Windwaker.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

Ivoah

Quote from: catastropher on July 17, 2016, 03:22:16 PM
I've been working more on the "line texture" abilities; now it's possible to add more complex line-art to walls. This will allows for fairly detailed scenes using art that is made entirely of lines. I may be in the minority here, but I actually like the look of sold wireframe rendering - it feels really retro to me for some reason!

[spoiler=Line-art][/spoiler]

XBuilder has a simple line art editor now (though it kinda sucks because I implemented it all in one day). Making that aperture logo by hand with lines was really hard though XD
Now you need to add the ability to render SVGs :P
  • Calculators owned: TI-86 (now broken), TI SR-56, TI-Nspire CX CAS, TI-84+ SE, TI-84+ SE, TI-85, TI-73 Explorer VS, ViewScreen, TI-84+ CSE, TI-83+ SE

catastropher

Quote from: DJ Omnimaga on July 17, 2016, 03:40:28 PM
Wow I didn't know that kind of textures was possible. I assume you can assign them to each wall like with regular textures? I think this could be handy for writings and other effects.
That is indeed how they work! You'll also be able to attach them to the faces of models (which is what I plan to do for the companion cube and other things).

Quote from: DJ Omnimaga on July 17, 2016, 03:40:28 PM
Also can you mix both wireframe and textured mode? Someone could make a Celshading-like game like Zelda: Windwaker.
Hmmm... that's an interesting question. For right now, I'm just focusing on wireframe mode but I'll keep this in the back of my mind.

Quote from: Ivoah on July 17, 2016, 04:50:11 PM
Now you need to add the ability to render SVGs :P
Tbh, that's what they practically are, just with lines XD The great thing is that the "line textures" can be rotated and scaled without looking crappy! :D

Btw, I'm going to need beta testers at some point (phase 1 is almost done). Any takers?
  • Calculators owned: TI-83+, TI-83+ SE, TI-84+ SE, TI-Nspire CX, TI-92+, TI-89 Titanium
Creator of X3D, a 3D portal rendering game engine for Nspire, 68k, and PC

Lionel Debroux

Which platforms do you plan on targeting for the first beta ? :)
Member of the TI-Chess Team.
Co-maintainer of GCC4TI (GCC4TI online documentation), TIEmu and TILP.
Co-admin of TI-Planet.

catastropher

I have returned! Mwhahaha! I have been working on something new for X3D. It runs very very slow at the moment, but it will be much faster after some optimization. May I present: light maps!

[spoiler=X3D Light Map][/spoiler]

I only implemented this today so it still has a long way to go (implementing shadow mapping was hard but fun!). Light maps, which were used in Quake, allow for semi-realistic lighting by precomputing "light textures" for every polygon in the level. These are then applied on top of regular textures to create a lit, textured mapped environment. The only caveat is that they can only be used to for static lights and static objects. Still, I think the results will be very impressive! This currently runs at 1 fps on the calculator for a number of reasons (one of the reasons is that I'm using floats for the rasterizer instead of fixed point). I'm very guilty of too much optimization too soon so I will optimize once I get everything working.
  • Calculators owned: TI-83+, TI-83+ SE, TI-84+ SE, TI-Nspire CX, TI-92+, TI-89 Titanium
Creator of X3D, a 3D portal rendering game engine for Nspire, 68k, and PC

Ivoah

Looks great! What would be required to allow dynamic light sources?
  • Calculators owned: TI-86 (now broken), TI SR-56, TI-Nspire CX CAS, TI-84+ SE, TI-84+ SE, TI-85, TI-73 Explorer VS, ViewScreen, TI-84+ CSE, TI-83+ SE

Dream of Omnimaga

Glad to see you again Catastropher. That lightning effect looks cool! If you can manage to make it run at good speed I am starting to wonder if this engine will not end up having better shading and lightning than PS2/Dreamcast games? O.O
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

p4nix

Very great work @catastropher, as a person who only got displaying and moving away from a triangle (on one axis, lol) done yet I'm really jealous of your work :P

Keep it up and good luck optimizing your code.
  • Calculators owned: fx9860GII (SH4)

catastropher

Quote from: Ivoah on September 21, 2016, 01:47:40 AM
Looks great! What would be required to allow dynamic light sources?
Thanks! Probably an insane amount of computation power haha I'm going to do some research into how Quake did things. I'll let you know if I find a way to do it!

Quote from: DJ Omnimaga on September 21, 2016, 06:17:13 AM
Glad to see you again Catastropher. That lightning effect looks cool! If you can manage to make it run at good speed I am starting to wonder if this engine will not end up having better shading and lightning than PS2/Dreamcast games? O.O
Thanks, it's good to be back! Also, thank you! I'm hoping to really push the calc to its limits! :D

Quote from: p4nix on September 21, 2016, 05:09:43 PM
Very great work @catastropher, as a person who only got displaying and moving away from a triangle (on one axis, lol) done yet I'm really jealous of your work :P

Keep it up and good luck optimizing your code.
Thank you as well! If you ever need any help with anything, let me know!
  • Calculators owned: TI-83+, TI-83+ SE, TI-84+ SE, TI-Nspire CX, TI-92+, TI-89 Titanium
Creator of X3D, a 3D portal rendering game engine for Nspire, 68k, and PC

Dream of Omnimaga

Just be sure that the programmer can enable/disable engine features by just changing certain config values so that if they want their games to run on lower-end models (the TI-84 Plus CE, for example, if it ever gets supported), then they can run at decent speed at the cost of not having shading or lightning, for example.
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

TheMachine02

#236
Quote from: DJ Omnimaga on September 22, 2016, 02:01:28 AM
the TI-84 Plus CE, for example, if it ever gets supported

* TheMachine02 prepares for benchmarking  :P

Anyway, more serioulsy, the light map is just awesome. Btw, how do you do your blending ? Your lightmap hold an intesnity or directy a light color ?


EDIT : if you want dynamic light I recommand to read this tutorial : http://learnopengl.com/#!Advanced-Lighting/Shadows/Shadow-Mapping which explain how to do shadow mapping, ie the actual technique.

catastropher

Quote from: DJ Omnimaga on September 22, 2016, 02:01:28 AM
Just be sure that the programmer can enable/disable engine features by just changing certain config values so that if they want their games to run on lower-end models (the TI-84 Plus CE, for example, if it ever gets supported), then they can run at decent speed at the cost of not having shading or lightning, for example.
Yeah, I made sure to implement the engine so that it has a number of different rendering modes (currently it has line, flat shading, gouraud shading, texture, texture + gouraud shading, and texture + lightmap).

Quote from: TheMachine02 on September 22, 2016, 09:59:11 AM
Quote from: DJ Omnimaga on September 22, 2016, 02:01:28 AM
the TI-84 Plus CE, for example, if it ever gets supported

* TheMachine02 prepares for benchmarking  :P
Anyway, more serioulsy, the light map is just awesome. Btw, how do you do your blending ? Your lightmap hold an intesnity or directy a light color ?
Thanks! Right now the lightmap holds the intensity, but I'm going to be changing the engine to use 256 color mode. This means I can use the following approach:

  • The lightmaps are calculated using a very expensive preprocessing step in low-resolution, storing intensity
  • When a polygon is visible, a high-resolution lightmap is built from the low-res one by using bilinear filtering
  • The polygon's texture is combined with the lightmap to create the final texture that is displayed (this can be done using a color table)
  • This final texture map can be cached and reused between frames. If it hasn't been used for a few frames it can be freed.
This sounds expensive, but will actually be very fast. I think I'm going to use Quake's color palette (https://quakewiki.org/wiki/Quake_palette). Although, I may allow the user to customize it.

In the last screenshot, I only had lightmap generator working. Here is the lightmap combined with texture mapping (using a very slow two texture method - this will be replaced with the above algorithm once I change the engine to use 256 color mode):

[spoiler=X3D Lightmap + Texture][/spoiler]

I will post more of my progress when I make it!
  • Calculators owned: TI-83+, TI-83+ SE, TI-84+ SE, TI-Nspire CX, TI-92+, TI-89 Titanium
Creator of X3D, a 3D portal rendering game engine for Nspire, 68k, and PC

Dream of Omnimaga

I wonder how good this engine would look like with textures from Pokéwalrus? :P

Looks very good, as always, by the way. :)
  • Calculators owned: TI-82 Advanced Edition Python TI-84+ TI-84+CSE TI-84+CE TI-84+CEP TI-86 TI-89T cfx-9940GT fx-7400G+ fx 1.0+ fx-9750G+ fx-9860G fx-CG10 HP 49g+ HP 39g+ HP 39gs (bricked) HP 39gII HP Prime G1 HP Prime G2 Sharp EL-9600C
  • Consoles, mobile devices and vintage computers owned: Huawei P30 Lite, Moto G 5G, Nintendo 64 (broken), Playstation, Wii U

catastropher

Quote from: DJ Omnimaga on September 23, 2016, 03:39:04 AM
I wonder how good this engine would look like with textures from Pokéwalrus? :P
Feel free to send any textures my way!

Quote from: DJ Omnimaga on September 23, 2016, 03:39:04 AM
Looks very good, as always, by the way. :)
Thanks! :D

So I heavily optimized lightmap rendering. Things actually look pretty smooth now! Want to give it a try? Check out the attached demo program!

Keys:

       
  • Look around: arrow keys
  • Move forward/backward: 7/4
  • Add a new light at the camera's current position and angle: enter
  • Quit: esc
A few notes:

       
  • You can add a light but you can't remove one (they become "baked" into the level)
  • Adding a light might take a few seconds - computing light takes a lot of calculations (in floating point)! Also the screen will be flat shaded with weird colors as it's calculating. This is for debug purposes
  • Only spotlights with a fixed angle are implemented currently - this will change in the future
  • Don't walk outside the level because there's no collision detection! haha
  • I use affine texture mapping so the textures may shift strangely at certain angles
  • X3D now renders in 256 color mode (I stole Quake's color palette haha)
Please give me any feedback you may have! :D
  • Calculators owned: TI-83+, TI-83+ SE, TI-84+ SE, TI-Nspire CX, TI-92+, TI-89 Titanium
Creator of X3D, a 3D portal rendering game engine for Nspire, 68k, and PC

Powered by EzPortal