quarc_visualization_texture_baking_demo.mdl
Open this model

QUARC Visualization Texture Baking

This is an example of a shadow technique described in the Visualization Shadows help page. The pumpkin and base plane use textures where all the lighting was precomputed and "baked" into the texture. This allows for very realistic lighting and shadow casting such as the stem casting a shadow down the skin of the pumpkin and the minor bumps on the surface of the pumpkin itself. However, the disadvantage is that it will not react to lighting changes or motion in the scene. As such, this approach is typically only useful for items in your scene that do not move relative to the light sources.

Since all lighting is precomputed in this scene, no light sources are necessary and the emissivity of all actors (with the exception of the interior of the pumpkin) is set to 1. The pumpkin interior emissivity varies with the noise source to emulate a flickering candle.

QUARC Visualization Texture Baking Demo Simulink model

Demonstration

To start the model, click the Run button on the toolbar, select Run from the Simulation menu of the diagram, or press Ctrl+T while the diagram is the active window. Using the A, S, D, and W keys on your keyboard, you can move around the scene. Click-drag your mouse on the visualization window to rotate your view.

If you would like to run the model in external mode, then select External from the Simulation/Mode menu of the diagram, or select External from the simulation mode combo box on the toolbar.

Then select Build from the QUARC menu of the diagram, or press Ctrl+B while the diagram is the active window. A great deal of output will appear in the Diagnostic Viewer about the progress of the build. If you cannot see the Diagnostic Viewer, you can open it by selecting View/Diagnostic Viewer from the menu of the diagram, or clicking on the View Diagnostics hyperlink at the bottom of the diagram. If you have MATLAB R2013b or earlier then the output will appear in the MATLAB Command Window.

When the build is complete, click on the Connect to Target button or select Connect to Target from the Simulation menu of the diagram to connect to the model. This will load the code on the target and automatically open the visualization window on the host.

Finally, start the model by clicking on the Run button or selecting Run from the Simulation menu of the diagram. The Start item of the QUARC menu may also be used to both connect and start the model in one operation.

Click on the Stop button or select Stop from the Simulation menu of the diagram to stop the model. The Stop item of the QUARC menu may also be used.

Running the example on a different target

To run the example on a different target, refer to the instructions on the Running QUARC Examples on Remote Targets page.