Dawoodoz / DFPSR

Fast realtime softare rendering library for C++14 using SSE/AVX/NEON. 2D, 3D and isometric rendering with minimal system dependencies.
https://dawoodoz.com/dfpsr.html
79 stars 6 forks source link

Create light-map SDK example #16

Open Dawoodoz opened 4 years ago

Dawoodoz commented 4 years ago

The use of light-maps in the Cube example is quite ugly, because the secondary texture layer is generic rather than a baked light-map for the model. Importing levels with light-maps from an existing tool or creating light-maps dynamically would allow creating a much better example together with documentation of the workflow.

Dawoodoz commented 4 years ago

Extending the PLY importer from the Sandbox tool to include textures would make this reasonably easy.

Dawoodoz commented 1 year ago

Tried real-time shading to textures together with normal maps and specular light, and it can do the shading smoothly on background threads using swap chains while rendering. Because texture interpolation is the heavy part and aligned 2D filters are fast, using high-resolution lightmaps combined into the same image as the diffuse material colors is both faster and better looking. Maybe this can be used as the high quality setting with realtime specular light up close and then just passively update diffuse light of nearby rooms in a low setting for laptops.

Dawoodoz commented 1 year ago

This would be a good place for testing new occlusion shapes in complex scenes with large moving occluding objects.

Dawoodoz commented 1 year ago

There is already functions for generating normal and position maps for polygon models, and lightmaps from normal and position maps, but generating UV2 coordinates still needs an automatic unwrapping algorithm to simplify the workflow.

Once normal and position maps are generated from smoothed vertex normals for a highly detailed model, one can apply a polygon reduction algorithm for displaying it from far away using the same normal map. The highly detailed asset could also be excluded from the final game to save space.

Static instances of a model could pre-transform their own normal and position maps, used to generate both a static and a dynamic lightmap. Dynamic instances do matrix transforms while updating lightmaps.

Very large surfaces in outdoor scenes could use blend maps to avoid wasting space on large lightmaps.