Minor 3d update!

Hi,

Ok, a little update on monkey2’s 3d progress!

I’ve only really spent a couple of weeks on it full time so far (and have had some kind of nasty flu-bug thing over the last few days so have been taking it easy this week) so there’s not all that much done, but in a nutshell:

* There’s a simple model/surface/material system going. Surfaces have a material, vertices and indices and are attached to models, very similar to b3d’s mesh/surface/brush system. Also CreateSphere and CreateBox for testing. All this may or may not yet be thrown away. Also, simple skybox support.

* There’s a pretty cool ‘PBR’ shader going. PBR stands for ‘physically based rendering’, which, as far as I can work out, is really just a slightly different approach to how diffuse/specular/normalmap etc are parameterized, and a few additions/tweaks to the good old ‘blinn-phong’ shader code to make it more realistic. Crash course in PBR is here:

http://renderwonk.com/publications/s2010-shading-course/hoffman/s2010_physically_based_shading_hoffman_b_notes.pdf

I don’t understand all of that(!) but I had a play around with it a few years ago (in c++) and worked out enough to get it ‘sort of’ going so had a bit of a head start. (It was fun getting back into the ‘shader groove’ too!) Also, I recently discovered this which clarified a few things that had me guessing first time around…

https://seblagarde.wordpress.com/2011/08/17/hello-world/

I’m now pretty happy with the results although I’m sure there will be heaps of tweaks to come – esp. from people who *really* understand all the math!

In practice, PBR affects the parameters/colors/textures etc used by materials, but not a lot really. The way I’ve done it, materials have diffuse/specular/gloss/normal colors/maps so it’s almost the same as b3d brushes (although the ‘meaning’ of some parameters differs a little). There are other approaches too such as diffuse/metallic/roughness/normal, which can easily be provided for via a different shader if necessary – and may be better, dunno yet!

What’s the point of this PBR stuff anyway? Well, the biggy is it just plain looks better because the underlying algorithms are better, but IMO PBR is also easier to use. This page has some hints on how PBR colors work and basically they’re just hardcoded diffuse intensities for non-metalic (or ‘dielectric’) materials (with about .04 specular – everything has specular!), and hardcoded specular colors for metalic materals (with black diffuse).

https://seblagarde.wordpress.com/2011/08/17/feeding-a-physical-based-lighting-mode/

PBR can (theoretically) achieve these sorts of results:

https://www.google.co.nz/search?q=physically+based+rendering+examples&tbm=isch

Note that mx23d may not be capable of this level of quality just yet, but the ‘pieces’ are mostly all there I think.

I realize that not all mx23d users are gonna be doing stuff to this level (or are even particularly interested in ‘realism’ in the first place), but even for casual users, I think PBR will be a big win regardless of what you’re doing.

* There’s also a simple gltf loader going. No anim stuff yet, and bizarrely glTFv1.0 has no built-in (ie: non-extension) support for normal maps (glTFv2.0 does, apparently coming very soon) although I’m sure we can kludge something in here if necessary.

Next up, I am going to start work on the entity system, including basic bullet physics integration and animation. This is a pretty exciting time as it should mean I have some stuff flying around relatively soon!

Everything is still gles2 and I haven’t yet decided whether to go to gles3. Nothing I’ve done so far *needs* gles3 so gles2 is still an option at this point, so I don’t see the need to make any firm decisions about this right now. There are some good points on the pros/cons of using gles3 or gles2 here:

http://monkey2.monkey-x.com/forums/topic/gles3-0-vs-gles2-0-for-mx23d/

Feel free to add your own thoughts/comment(s) but please be nice!

Also, please follow me on twitter @blitzmunter for occasional screenshots of my 3d progress.

Finally, there is no source code yet (and wont be until I have a clearer picture of how it’s all gonna end up) but I’d like to remind everyone that the monkey2 3d module *will* be open source! There seems to be a bit of confusion about this going by some posts on the forums.

Bye,
Mark

User comments
Pakz says:

Good news!

What I will most likely am going to do with it is making procedural indoor maps(fps)Β and work my way towards making a game like that of the elder scrolls kind. Smaller though since I work alone. Maybe minecraft things also. All for fun though.

i will keep donating every now and then with paypal. Having fun still with monkey 1 atm.

 


AdamStrange says:

Can’t wait to test out the PBR. Get to hear what’s going on πŸ™‚ Sorry to hear your not feeling brilliant at the moment.


degac says:

Hi, good news!

PBR support seems very interesting and maybe a plus compared to other 3d module (supposing that using it is/will be very easy!)
I imagine there will be some sort of ‘pre-built’ material (like the colors) for immediate use.

CreateSphere() and CreateBox() are a must, they should be in πŸ™‚
Moreover, I think that basic entities creation should be present (many games are geometry based, no need of many 3d mesh loaded!)

Questions:
how much of the ‘old’ code (ie: Max3d) can be used/copied in the MX23d (to speed up progress, without re-inventing the wheel? I think making/coding the same thing (entity for example) is quite… boring after Blitz3d and Max3d!)
it will be a 3d ‘module’ (just graphics, like in Blitz3D) or it will have something ‘more’ (like LevelOfDetail, asset-pre loading, some sort of IA, automatic support for hiding levels etc) (not necessarly needed, just to know what could be in ‘beta 0.1’ version.
please, choose a proper name, MX23D seems a serial number… as you implemented PBR support – and it seems ‘central’ in this 3d module – you could think to something related, like Iris, Photon, Matter, Reflex, Wave etc


Ethernaut says:

Can’t wait to try it!

My only request is that the entity system should be very extensible. Also, consistency. I’d love if things like lights and objects were all extended from the same base entity class, for instance, and more or less follow the same rules.

Cheers!


Markus says:

Hi, yeah i like 3d πŸ™‚ i spent a lot of time in blitz basic 3d.

myself required 3d content loader for dae,fbx. i have shade3d 15,carrara8.5,Cheetah3D,ac3d

apart from that, shadows is a must have.

 


Sub_Zero says:

Just keep the donations coming!

I just donated!


Mark Sibly says:

I just donated!

Thanks!

 

 


Mark Sibly says:

Good stuff!

 


AdamStrange says:

one thing about the uniforms

How about a time uniform. this is currently missing from the 2d shaders and needs adding.

Time allows shaders to do water and anything that moves its surface over time. star field for example πŸ˜‰