Super mario 64 tech demo

at the moment global illumination derives only from the procedurally generated equirectangular map using world parameters (ground color, skyColor, fogColor, fogHeight, etc …) soon i’ll add the contribution of the objects in screen space


Here the green light from below is evident (grass) but it is dynamic image based diffuse reflection.

I have equipped the Ambient occlusion effect with an option that if the pixel is hit by light then the AO is reduced as function of the light intensity. At the beginning of the video, the sun is perfectly at the zenith and everything is hit by sunlight so it is as if the ambient occlusion did not exist.


without strong light on the surfaces the AO is more evident

Instancing is currently supported, but works differently. For a single object, the dedicated python component has to be activated and you need to choose the mesh to be instanced, and set the material parameters, finally you need to pass a list of tuples as (pos, ori, scale).
I had already thought about creating a plugin for Blender to automate everything by exporting a file that contains exactly these data for each object, but I have not yet done so. However, this data could be obtained directly from the Blender scene even with a simple script like this:

instancingData = []
for obj in instancedObjsList:
    pos = obj.worldPosition
    ori = obj.worldOrientation
    size = obj.worldScale
    t = (pos,ori,size)
    instancingData.append(t)

Python!
When you add an object/asset you can attach to it a script using this code:

myPythonComponent = lib.getLogicComponent("myPythonComponentName") #your custom python components are stored in your libs
pyComp = obj.pythonComponents.add(myPythonComponent) #now obj as your component attached 

You can hook and unhook python components to objects dynamically during the game, but you can also hook them at init time by specifying in the asset definition script.

2 Likes

Right, perhaps sometimes you don’t need instancing if the object duplicate linked is only duplicated three times for example. GPU instance should be perhaps activable by user.

Great, that looks simple and easy to use.

For collisions, Will this read Blender collisions setup ?
Collision object type and parameters, collision layers, collision type bounding box shapes or polygon object.

Will this support compound collisions per game object ? Multiple basic shapes (box, capsule, spheres) parented together.

Will there be some option to be able to obfuscate the code user make ?

of course I was referring to all the objects for which the user wants instancing (for example trees if you have many) The gpu instancing is very good especially for static objects because you have to generate and sends the buffer of the model matrices only once (cpu works on the init frame only), so even if the static objects in question are few, it is always advantageous

The collision is managed by the user; to an object you can attach a collisionMesh that can be procedurally generated using the usual simple geometries (sphere, box, capsules, cone etc) Otherwise, by passing a .obj file you can generate the collision mesh as convex hull or triangle mesh.
When you put .obj files it in the appropriate folder of your personalized library sabge will load them in RAM autonomously as soon as the library is loaded in the 3D scene.
The parenting system is the same as bge and the compound collisions is supported in the same way
The “setParent” function has also been extended with optional parameters in order to also support types of constraints other than the fixed joint. Since the parenting with active compound collision is nothing more than a form of constraint it seems logical to me to solve the whole question of the various constraints here. So for each joint it is possible to vary the specific physical parameters relating to the chosen constraint and possibly apply motors.

.pyc (python compiled)

2 Likes

I mean in Unity for example, for some object you can add as many collision components primitives you want, there is nothing to do, jut adjust those primitives.
I’m not sure they have parenting perhaps they use fixed joint constraint on those primitives.

I like you add the possibility to use our own .Obj collision mesh.

1 Like

Those particle effects you showed off in the demo look great! How where they achieved?

1 Like

Hi thanks, this is a component that I have developed specifically for sabge and it is not one of the simplest so I will not explain too many technical details as it is a long topic and you could probably go deeper on the web. In general, each spawned particle system is managed physically by its own not too complex physical engine implemented via compute shader (here I’m using openGL 4.5) then on the gpu, thus relieving the cpu from any work. Just at init time (spawn), cpu side, a single mesh is generated composed of as many particles (quads) as you want for the system you are going to add to the scene (batched rendering). All this makes everything very performing and allows you to have many different particle systems on the screen, also consisting of a large number of particles.
Finally, each particle (if visible) is rendered through a specific fragment shader that can be replaced (in my implementation of this component) at will to increase the level of customization on the final appearance of the particle systems although the default ones, both for additive and non-additive blend mode particles, are already customizable enough simply through textures/parameters.

From the user (game dev) side a code example of the function here used to generate the orange particle system spawned when mario collides with a goomba.
(This function is implemented inside the mario’s main class)

def addParticleSystemAdditive(self,pos,direction):
		particleSystemObj = self.lib.addObject("particleSystem",80)#add an empty object to the scene with life 80 frames
		particleSystemObj.worldPosition = self.Vector(pos)
		particlesFX = particleSystemObj.pythonComponents.add(self.particlesFX_ComponentAdditive,"particlesFX")#attaching the pythonComponent to the obj

		#particle system parameters
		numParticles = 256
		color = [1,1,1]#particles are white
		emissionColor = [0.3,0.1,0.0]#emission is orange
		colorDecay = 0.90
		mass = 0.1
		elasticity = 0.85
		particleSize = 0.1
		particlesFX.start(numParticles, color, emissionColor, colorDecay, mass, elasticity, particleSize, direction)
2 Likes

This sounds like a really flexible and well thought out solution. The fact it runs mainly on the GPU is great. Very nice system!

1 Like