3D Gallery with Great Artwork Imagine Logo with Three Colors Beach Cabin 3D Android Tablet with Different Screens Studio Apartment Red Figured Greek Vase on Blue Background Silver and Gold Flashlight Lake on Fire

3D Logo

Change Light Maps

Tap the logo to change visual effects. Swipe to rotate. View in three dimensions with different light maps.

Swipe to View. Tap for Graphics

Light Map Buttons. Tap to Change Maps.

Filter Colors Filter Colors Filter Colors Filter Colors Filter Colors Filter Colors

Visual Effects

Swipe to view the logo. Tap the logo, or buttons, to change light maps.

This example mixes textures in the GLSL fragment shader for unique effects. Individual light maps display on the light map buttons. Tap a button to see the light map on the logo.

Images on the buttons load and stretch across the canvas, providing colors for the logo. The light map remains stationary while you swipe to rotate the logo. For example notice the wolf always looks out toward you even while the logo's rotated away from the viewport. Yet highlight and shadow continue to provide dimension to the shape.

Light & Shadow

A highlight and shadow texture map provides a sense of depth to the symbol. The highlight and shadow texture map was prepared with 3ds Max's render to texture feature.

Preparaton

The symbol was modeled with 3ds Max and ported to WebGL with my 3D Translator. 3D Translator's freely available on the Microsoft Store.

Fragment Shader

The fragment shader's implemented in the C language. This shader mixes two textures. The first texture, in u_sampler0, provides light and shadow to the symbol. The second texture, in u_sampler1, stretches across the canvas and mixes with the light and shadow map to provide color on the logo.

precision mediump float;
uniform sampler2D u_sampler0;
uniform sampler2D u_sampler1;
varying vec2 v_tex_coord0;
uniform float u_dim;

void main(void) {

// Canvas width and height:
vec2 v2_resolution = vec2(
u_dim,
u_dim
);

// Sample the light map.
// The light map stretches 
// across the canvas.
vec4 v4_color1 = texture2D(
u_sampler1, 
(gl_FragCoord.xy/v2_resolution.xy)
);

// Sample the highlight
// shadow map.
vec4 v4_color0 = texture2D(
u_sampler0, 
v_tex_coord0
);

// Mix the maps 
// 50% each.
vec4 v4_mix    = mix(
v4_color0,
v4_color1,
0.5
);

// Color the canvas.
gl_FragColor  = v4_mix;

}

Light & Shadow Map

Shadow map prepared with 3ds Max's render to texture feature.

Light and Shadow RTT Map
Tags
Web GL, 3D Programming, 3D Development, 3D Media, 3D Web, scenes, backgrounds, 3D background, environment, 3D Web Design, 3D Web Development, create 3D website, GLSL, 3D 3ds Max, HTML5, HTML 5,3D Media, JavaScript, GLSL, C Language, Shader Programming, Interactive, Swipe Over Scenes

Ads >
Create 3D Games: Learn WebGL Book 2 Simple Shaders: Learn WebGL Book 4
3D Programming for Beginners: Learn WebGL Book 1

for Web graphics!

Copyright © 2022 Amy Butler. All Rights Reserved.