- For built-in fragment shader outputs, a new field
use_default_depthis added (defaultFalse) instead of relying on checking ifgl_FragDepthisNaN. - Change
ZBuffervalue meaning to OpenGL convention: all values are non-negative, and the smaller the value, the closer the point is to the camera. - Change default
Shader.mixerbehaviour: now it picks the fragment with minimum depth valuegl_FragDepth. - Change
shadow.py::Shadow.render_shadow_mapaccording to the z-value definition change, to add into the shadow map instead of subtracting so to move shadow maps further away from the "camera" (light). - Change
shaders/phong_reflection_shadowaccording to the z-value definition change. - Transform shadow coordinates in VS (world => NDC) and FS (NDC => screen) instead of transforming in FS (model's screen => world => screen) to avoid precision loss in inverse matrix computation.
- Fix issue of perspective-correction barycentric interpolation in
pipeline. - Fix
shaders/phong*so normals are correctly transformed into pre-projection eye coordinates, rather than being projected. - Rename
ModelView=>View,model_view=>view,model_view_matrix=>view_matrixas the matrix is actually view matrix that transforms from world to eye space, not model view matrix (model to eye space).
- Change the default behaviour of
renderer/utils.py::transpose_for_displaywhich will flip vertically as well by default, so the origin of the resultant matrix will be (height, width, channels) and with the origin located at the top-left corner. The previous behaviour can be achieved by settingflip_vertical=False. Scene.add_cubenow accepts one number fortexture_scalingto scale texture map equally in both x and y directions.- Fix some assert message issues (in
Scene.add_cube). CameraParametersnow acceptsposition,targetandupin Python's tuples of floats as well, along withjnp.array.Scene.set_object_orientationandScene.set_object_local_scalingsupports tuple of floats as well as inputs, additional tojnp.array.Modelnow has a convenient methodcreateto create a Model with same face indices shared byfaces,faces_normandfaces_uv, and a defaultspecular_map. This is useful for creating a mesh where all vertices has its own normal and uv coordinate specified, under same order (thus same face indices).- Correctly support Python Sequence for
utils.build_texture_from_PyTinyrendereras texture. quaternionfunction to create an orientation from axis and angle, andquaternion_multo composite quaternion.rotation_matrixfunction to create a rotation matrix from axis and angle. Also allowsSceneto set object orientation directly using rotation matrix.- Move
Renderer.merge_objectsintogeometry.py, and expose in__init__.py. batch_modelsandRenderer.create_buffersconvenient method to facilitate batch rendering of multiple models.
- Change the ordering of quaternions (in
geometry.py) to(w, x, y, z)instead of(x, y, z, w)to be consistent with the convention used inpytinyrendererandBRAX. Reference: brax/math.py. - Fix: remove unnecessary
@staticmethoddecorator inmerge_objects. - Changed the way that
Camerais created inRenderer.create_camera_from_parametersto force convert parameters intofloatweak type. - Force convert
LightParametersto JAX arrays inRenderer.get_camera_imageto avoid downstream errors. - Downgrade minimum Python version to
3.9,numpyversion to1.22.0,jaxandjaxlibversion to0.4.4.
- Correctly force convert
LightParametersto JAX arrays inRenderer.get_camera_imageto avoid downstream errors. - Fix
geometry.py::transform_matrix_from_rotation. Also, change the order of quaternion to(w, x, y, z)instead of(x, y, z, w)for consistency. - Force convert
ShadowParametersto JAX arrays inRenderer.get_camera_imageto avoid downstream errors.
- Instead of clipping (planned to be implemented), now the rasteriser interpolates in homogeneous space directly.
Shader.interpolatewill not receive validbarycentric_screenvalues for now. SettingInterpolation.SMOOTHandInterpolation.NOPERSPECTIVEwill result in same results, perspective-correct interpolations. - Reorganise example files and rename them.
- Refactor
Scene.set_object_*methods to be a simple wrapper ofself._replaceandModelObject.replace_with_*, to expose APIs ofModelObjects and allows manipulation and rendering withoutScene. - Expose
create_capsuleandcreate_cubeAPIs.
- Fix
gl_FrontFacingcomputation in pipeline so it is consistent to comment:Trueif not back-facing (i.e. front-facing & side facing). - Add an extra stage
Shader.primitive_chooserto choose which primitive to be rendered for each fragment. The default implementation is provided, which assumes that the depth is just the interpolatedzvalue in the eye space. It just picks the values of the single primitive that is closest to the camera and is not discarded in the previous pipeline. - Expose
loop_unrollstatic option to allow unrolling several operations (row rendering) within a single iteration of the out-most loop (iterating along first axis of the canvas). This may be useful in some cases for performance improvement, but careful benchmarking is needed to determine the optimal value. The default value is1(no unrolling) as it is the most general case in larger canvases (benchmarked on960x540using GPU T4 in Colab). - Bump the minimum Python version to Python 3.10
- Lower the minimum jax & jaxlib version to 0.3.25.
- Lower minimum Python version to 3.8
- Introducing
type_extensionspackage and improved typing annotations.
- Bump minimum
jaxandjaxlibversion to 0.4.0 asjaxtypingdoes not supportjax0.3.25. - Bug fix: add
static_argnamesfor utility functiontranspose_for_display. - Change to isort + black code style.
- Migrate full codebase to be type-checked with pyright.
- Add smoke tests, and use GitHub Action as CI to run them.