Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

3D engine... Much interest?
Started by richard11 Dec 23 2018 04:52 PM

71 replies to this topic
[TOPIC CONTROLS]
Page 3 of 3 1 2 3
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#51

richard11

[GLOBAL: userInfoPane.html]
richard11
  • Contributor

  • 294 posts
  • Corona SDK

Ambient lighting works =)

 

https://youtu.be/O4-dgfAVXpU


  • Michael Flad, StarCrunch and SGS like this

[TOPIC: post.html]
#52

richard11

[GLOBAL: userInfoPane.html]
richard11
  • Contributor

  • 294 posts
  • Corona SDK

And an Android APK demo for anybody who wants to see it in actual quality... Seems the video recording left some odd artifacts annoyingly...

 

https://development.qweb.co.uk/3D%20test.apk



[TOPIC: post.html]
#53

agramonte

[GLOBAL: userInfoPane.html]
agramonte
  • Contributor

  • 920 posts
  • Corona SDK

Wow! I am impressed. 


  • richard11 likes this

[TOPIC: post.html]
#54

chris_raz

[GLOBAL: userInfoPane.html]
chris_raz
  • Contributor

  • 223 posts
  • Corona SDK

Yeah this is amazing stuff


  • richard11 likes this

[TOPIC: post.html]
#55

richard11

[GLOBAL: userInfoPane.html]
richard11
  • Contributor

  • 294 posts
  • Corona SDK

Thanks. Those older screenshots look strangely pathetic now - amazing how much depth a bit of light can add.

Still a fair way from being a complete engine and still too early to benchmark lots of objects, but it's definitely feasible to make at least simple games with 3D visuals using it.

[TOPIC: post.html]
#56

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Contributor

  • 428 posts
  • Corona SDK

Often when I'm creating something, my friends ask me: "But, why?", to which the answer is usually a mix of "because I can", "because I want to see if I can", or "because It'd be cool". 

Now, even I am thinking: "Why create 3D object rendering and lighting in Corona, a 2D game engine, when there are fully fledged 3D game engines out there?", but in the back of my mind I already know... because it'd be cool and because you can :D



[TOPIC: post.html]
#57

richard11

[GLOBAL: userInfoPane.html]
richard11
  • Contributor

  • 294 posts
  • Corona SDK

Pretty much =)

This started as an itch more than anything else. We don't have any games in the pipeline that it needed to be built for, but if we're asked to do something in 3D I'd prefer that Corona was an option for that, and more often than not the bloat of a fully fledged engine like Unity is unnecessary. Of course, if we're asked to do something huge in 3D, this is unlikely to ever be the better option.

Hopefully though, once ready for release it'll be useful enough to at least some of you, and not just an interesting concept...

[TOPIC: post.html]
#58

SGS

[GLOBAL: userInfoPane.html]
SGS
  • Corona Geek

  • 1,943 posts
  • Corona SDK

Well if a 3D engine can hack 2D why not the other way around?

[TOPIC: post.html]
#59

XeduR @Spyric

[GLOBAL: userInfoPane.html]
XeduR @Spyric
  • Contributor

  • 428 posts
  • Corona SDK

You may have mentioned this at some point, but does the engine (or will the engine) support loading custom 3D models created in Blender, for instance. If I were to create some basic models consisting of 20-30 or even 100 polygons, would the engine be able to support them?



[TOPIC: post.html]
#60

richard11

[GLOBAL: userInfoPane.html]
richard11
  • Contributor

  • 294 posts
  • Corona SDK

It'll be able to import .obj files eventually, which Blender can export. They're plain text so should be easy enough to use.

Although the engine only has cubes at the moment, the actual rendering doesn't care what the shape is. It's literally just that I haven't mapped out the vertices for anything else yet.
  • XeduR @Spyric likes this

[TOPIC: post.html]
#61

agramonte

[GLOBAL: userInfoPane.html]
agramonte
  • Contributor

  • 920 posts
  • Corona SDK

Although I don't have any desire to do a 3D game it would be nice to have some 3D elements in my 2D game. At least it would be fun coming up with ideas to use it. And if it is going to cost around the same price as your other plugin than to me it is an easy buy.



[TOPIC: post.html]
#62

richard11

[GLOBAL: userInfoPane.html]
richard11
  • Contributor

  • 294 posts
  • Corona SDK

It'll most likely be $15 yes. Potentially a little less to start with =)
  • Michael Flad likes this

[TOPIC: post.html]
#63

Michael Flad

[GLOBAL: userInfoPane.html]
Michael Flad
  • Contributor

  • 206 posts
  • Corona SDK

This will be a pretty cool plugin. Initially I would've thought this is wasted time/energy given the probably very low polycount limits, but now I can even see a usecase in one of my project for animated dice in my classic RPG system :)



[TOPIC: post.html]
#64

richard11

[GLOBAL: userInfoPane.html]
richard11
  • Contributor

  • 294 posts
  • Corona SDK

Great to hear. I think there's definitely room for 3D rendering within 2D games. Character selection, cut-scenes, NPC dialogue, etc. Used creatively it sort of shows the player that you can do 3D but have specifically chosen 2D for the gameplay because that's how you wanted it, rather than that you've created the game in 2D because you don't have the resources or skills to go that extra step. Subtle details like this, particularly on mobile, I think makes a game feel more thought out. If that makes sense?

[TOPIC: post.html]
#65

richard11

[GLOBAL: userInfoPane.html]
richard11
  • Contributor

  • 294 posts
  • Corona SDK

For the record, exactly like with Qiso, all rendering is done to a single display group that's created when the plugin initiates. So if you create your own display groups before and/or after loading up the plugin, you can render standard display objects behind or in front of the 3D display. Thus making adding 3D objects into 2D games totally feasible.

Building something similar to the early '3D' Lucasarts games where 3D characters were rendered into 2D scenes would be an interesting approach too. Grim Fandango felt brilliant to play and the 2D elements meant huge levels of detail (at the time) could be rendered in without impacting performance. I'd LOVE to see somebody create something like that in Corona.
  • sirmania likes this

[TOPIC: post.html]
#66

thomas6

[GLOBAL: userInfoPane.html]
thomas6
  • Contributor

  • 852 posts
  • Corona SDK

Wow! This is really cool! If you want some simple .obj files to do further testing with "real" shapes, let me know. I do lots of 3D modelling all the time and have plenty of low polygon stuff lying around ( as can be seen here: https://www.behance.net/gallery/21548071/Stranded-The-Game )



[TOPIC: post.html]
#67

thomas6

[GLOBAL: userInfoPane.html]
thomas6
  • Contributor

  • 852 posts
  • Corona SDK

I also think this will be great for in-between-level displays like rotating gold trophy cups, stars etc... to embellish things!



[TOPIC: post.html]
#68

richard11

[GLOBAL: userInfoPane.html]
richard11
  • Contributor

  • 294 posts
  • Corona SDK

Thanks @thomas6. Those models look perfect for testing! I really like their general style too, for the record.

It'll be a while yet before I can import them though. Back to prioritising client projects for the time being and there are a few more important things to build in before I get onto .obj support unfortunately.

[TOPIC: post.html]
#69

StarCrunch

[GLOBAL: userInfoPane.html]
StarCrunch
  • Contributor

  • 779 posts
  • Corona SDK

In the project I mentioned earlier I used some of Cosmin's Luapower code to load OBJ files. I remember having problems, but not what they were. Anyhow, my local files are attached. And again, there's that Assimp project, although obviously not pure Lua and so on.

 

Pruned down to relevant usage:

local huge = math.huge
local max = math.max
local min = math.min
local obj_parser = require("obj_parser")
local object3d = require("plugin.object3d")

local FaceParams = {}

local xmin, ymin, zmin = huge, huge, huge
local xmax, ymax, zmax = -huge, -huge, -huge

local obj = object3d.New(--[[ various arguments ]])

local handlers = {
  check_function = function(check) end,

  vertex = function(x, y, z)
    xmax, ymax, zmax = max(x, xmax), max(y, ymax), max(z, zmax)
    xmin, ymin, zmin = min(x, xmin), min(y, ymin), min(z, zmin)

    obj:AddVertex(x, y, z)
  end,

  normal = function(x, y, z)
    obj:AddNormal(x, y, z)
  end,

  texcoord = function(u, v)
    obj:AddUV(u, v)
  end,

  start_face = function() end,

  face_vtn = function(v, t, n)
    FaceParams[#FaceParams + 1] = v
    FaceParams[#FaceParams + 1] = t
    FaceParams[#FaceParams + 1] = n
  end,

  end_face = function()
    obj:AddFace(unpack(FaceParams))

    for i = #FaceParams, 1, -1 do
      FaceParams[i] = nil
    end
  end,

  line = function(v, t) end,

  material_def = function(material_name) end,

  material_attr = function(cmd, ...)
    if cmd == 'ka' or cmd == 'kd' or cmd == 'ks' then
      local r,g,b = ...
    elseif cmd == 'illum' or cmd == 'ns' or cmd == 'd' or cmd == 'tr' then
      local N = ...
    elseif ({'map_ka', 'map_kd', 'map_ks', 'map_ns', 'map_d', 'map_bump', 'bump', 'disp', 'decal'})[cmd] then
      local filepath = ...
    end
  end,

  material = function(material_name) end,

  group = function(group_names_t) end,

  smoothing_group = function(group_names_t) end
 }

 obj_parser(system.pathForFile("squirrel/model_647897911503.obj"), handlers)

Attached Files



[TOPIC: post.html]
#70

richard11

[GLOBAL: userInfoPane.html]
richard11
  • Contributor

  • 294 posts
  • Corona SDK

Thanks @StarCrunch, this looks interesting... and fairly different to my own approach!



[TOPIC: post.html]
#71

sporkfin

[GLOBAL: userInfoPane.html]
sporkfin
  • Contributor

  • 436 posts
  • Corona SDK

OK, how did I miss this topic!  Oh yeah, vacation ; )

 

@Richard this is fabulous.  I'm sorry to have missed so much of the conversation.  I've dabbled with making a 3D engine as well but it's based on 4-point perspective instead of a more accurate polygon-based 3D.   I look forward to giving your engine a test run whenever you complete it - no pressure - well, just a little  ;)



[TOPIC: post.html]
#72

richard11

[GLOBAL: userInfoPane.html]
richard11
  • Contributor

  • 294 posts
  • Corona SDK

@sporkfin if anything, I'd prefer people to jump in now rather than when I started this thread. Those old screenshots don't look nearly as impressive as I originally thought them to be, ha!

Sadly I've not had chance to work further on this since posting that last video and APK. I've conceptualised a way of handling intersecting faces but it's just in my head at the moment, and even I'm not convinced it wouldn't require too much processing work to pull off in Corona. The thinking hat is still on there.

I'll pick up on this again asap. Seems to be gaining a bit of interest ☺️
  • Michael Flad likes this


[topic_controls]
Page 3 of 3 1 2 3
 
[/topic_controls]