You can help CodeWalrus stay online by donating here. | New CodeWalrus | Old (dark mode) | Old (light) | Discord server

X3D - A 3D engine for TI68k & Nspire Calculators

b/[Inactive] X3D (TI-89/92+/v200/Nspire/PC) Started by catastropher, June 27, 2015, 02:37:43 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

u/catastropher 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
u/Dream of Omnimaga 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.

Also can you mix both wireframe and textured mode? Someone could make a Celshading-like game like Zelda: Windwaker.
u/Ivoah July 17, 2016, 04:50:11 PM
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
u/catastropher July 17, 2016, 05:25:30 PM
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?
u/Lionel Debroux July 17, 2016, 06:28:20 PM
Which platforms do you plan on targeting for the first beta ? :)
u/catastropher September 21, 2016, 12:50:39 AM
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.
u/Ivoah September 21, 2016, 01:47:40 AM
Looks great! What would be required to allow dynamic light sources?
u/Dream of Omnimaga 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
u/p4nix 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.
u/catastropher September 21, 2016, 10:45:15 PM
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!
u/Dream of Omnimaga 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.
u/TheMachine02 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 ?


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.
Last Edit: September 22, 2016, 10:23:52 AM by TheMachine02
u/catastropher September 22, 2016, 07:02:03 PM
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!
u/Dream of Omnimaga September 23, 2016, 03:39:04 AM
I wonder how good this engine would look like with textures from Pokéwalrus? :P

Looks very good, as always, by the way. :)
u/catastropher September 24, 2016, 04:55:40 PM
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
Website statistics


MyCalcs | Ticalc.org | Cemetech | Omnimaga | TI-Basic Developer | MaxCoderz | TI-Story | Casiocalc.org | Casiopeia | The Museum of HP Calculators | HPCalc.org | CnCalc.org | Music 2000 Community | TI Education | Casio Education | HP Calcs | NumWorks | SwissMicros | Sharp Calculators
Powered by EzPortal