Implementation

On loading, in onGeometryLoaded, it determines the Revit BIM wall fragments for subsequent ray tracing.

On picking a point on a floor in the model, in onSelection, it launches the attenuationCalculator function to do the work.

That fiddles around a bit to determine the picked floor top faces and add a new mesh to the model on which to draw the attenuation map.

Once the mesh has been added, it in turn calls rayTraceToFindWalls to create a bitmap representing the signal attenuation to be displayed by a custom shader.

Adding Custom Geometry to the Forge Viewer

When debugging any kind of geometrical programming task, it is of utmost importance to be able to comfortably visualise the situation.

In this app, I add three different kinds of geometry dynamically to the model displayed by the Forge viewer:

Points and lines representing the top face of the floor and the picked source point.

A mesh representing the top face of the floor to be equipped with a custom shader and offset slightly above and away from the floor element surface.

Points and lines representing the raytracing rays.

Three example screen snapshots illustrate what I mean.

Display points and lines for debugging using drawVertex and drawLine:

Create a mesh to represent the floor top face and offset it up slightly above the floor surface:

A debug helper displaying lines in the model representing the ray tracing rays:

Next Steps

Perform the raytracing to determine the number of walls between the picked signal source point and a grid of target points

Generate a bitmap based on that information, or simply a mapping of (u.v) values to the desired colour value.

Implement a custom fragment shader to display the (u,v) to colour mapping on the floor top face mesh.

Detailed Notes and Pointers

I made the following notes during the research and implementation steps.

Colour gradient examples:

A series of three consecutive approaches to solve the task, starting with the most obvious, for the learning curve.
However, the last in the series, using shaders, although last in the learning curve, once understood, is actually probably the most effective and simplest approach.

I want to attach a fragment shader to the picked floor face.
My shader should draw an image or texture directly, i.e., the desired 'heat map'.
Here are som more complex pixel shader samples.
I need to implement a fragment shader script and equip it with an id.