From 1e29bbf0c88578e84626117e826c2f8f03132a21 Mon Sep 17 00:00:00 2001 From: Piotr Mrozik <33581747+PiotrMrozik@users.noreply.github.com> Date: Thu, 22 Jun 2023 14:43:11 +0200 Subject: [PATCH] Add texture docs (#159) * Add texture docs --- docs/Usage.md | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/docs/Usage.md b/docs/Usage.md index 4be50787..bc615c17 100644 --- a/docs/Usage.md +++ b/docs/Usage.md @@ -8,7 +8,7 @@ The C API is built around several concepts that are introduced in the following ### Mesh -Mesh is a handle to the on-GPU data of a 3D model provided by user. +Mesh is a handle for the on-GPU data of a 3D model provided by user. Texture coordinates are optional and can be omitted. However, they are necessary for intensity calculation. ### Entity @@ -20,6 +20,15 @@ When created, entity is bound to a scene. Entity cannot be unbound from a scene To create an Entity it is required to provide a Mesh, which must be created first. Entities can share the same mesh. +### Texture +The texture is a handle for the on-GPU data of a 2D image provided by the user. It is used to calculate the intensity of a hit point. It is expected to be a grayscale image in 8-bit red channel data. The intensity is calculated by sampling the texture at the mesh's texture coordinates. If the texture coordinates are not present, the texture will not be sampled. + +The texture coordinates are calculated by interpolating the texture coordinates of the hitpoint's triangle vertices. The texture coordinates of the triangle vertices are provided by the user when creating the mesh and should be assigned via API call. The texture coordinates are expected to be in the range [0, 1]. If the range is exceeded, then the texture will be tiled. + +The texture is optional and can be omitted. If the texture is omitted, the intensity is set to 0.0. + +The texture is assigned to the Entity. Entities can share the same texture. + ### Scene Scene represents 'a place' where the raytracing occurs.