Verge3d + Blender: Interactive Table (web 3d/vr) — Step‑by‑step
Student Guide
This session focuses on adding realistic materials and
environment lighting to the interactive table. Students learn to apply a wood
texture using PBR and UV mapping, create a reflective chrome material for the
stand, and set up an HDRI environment for realistic reflections. It concludes
with a preview and export to verify that textures and lighting render correctly
in the browser.
Session 5A — Shadow and Background Masking
Goal: Add a realistic ground shadow for the table and
create a steady, non-moving background using masking with an emission shader.
1) Enable the Ground Sphere for Shadows
- In Outliner,
re-enable visibility (monitor icon) and render (camera icon) for the
ground sphere.
- Use
Sneak Peek to preview — the table is grounded but shadow may look
unclear.
2) Enable Shadows in Render Settings
- Go
to Render Properties → Verge3D Settings.
- Enable
Shadows option.
- Preview
with Sneak Peek — shadows are still weak but visible.
3) Configure the Light for Better Shadows
- Select
the lamp used in your scene.
- In Light
Properties → Shadows, make sure Shadows is enabled.
- Open
Cascaded Shadow Map settings:
- Change
Max Distance to around 20 (from default 1000).
- Adjust
Intensity:
- Reduce
Strength to 1 for softer lighting.
- Enable
Contact Shadows and set:
- Bias
≈ 4
- Distance
≈ 0.4
- Optionally
increase Intensity slightly (~1.7) if needed.
- Sneak
Peek — shadows should look more natural.
4) Fix Background Movement (Static Background)
- Switch
to Shading Workspace.
- Change
from World mode to Object mode.
- Select
the sphere object.
- In Material
Properties, click New and name it Sphere_Material.
- Delete
the default Principled BSDF node.
- Add
→ Shader → Emission node.
- Connect
Emission → Surface.
- Reduce
Emission Strength to 0.5.
- Sneak
Peek — background is now static, but shadows disappear.
5) Add a Mask for Shadows
- In Shader
Editor, Shift + A → Texture → Image Texture.
- Click
Open and select ground_mask.jpg (provided).
- Add
→ Shader → Mix Shader.
- Connect
Image Texture → Fac (factor input) of the Mix Shader.
- Connect
Emission Shader to one shader slot of the Mix Shader.
- Add
→ Shader → Principled BSDF (regular shader) and connect it to the
other shader slot of the Mix Shader.
- Connect
the Mix Shader output → Material Output Surface.
- Adjust
node connections so:
- Emission
shader = background.
- Principled
BSDF = ground area under the table.
- Sneak
Peek — shadows are restored, with a clean static background.
6) Finalize & Export
- Save
the project (File → Save).
- Export
updated scene (File → Export → Verge3D glTF) and overwrite the
existing app scene.
- In App
Manager, click Run to preview the updated app in the browser.
Troubleshooting
- No
shadow: Check shadow toggle in Render Properties and Light Properties.
- Shadow
too sharp or weak: Adjust Intensity, Bias, or Distance
under light settings.
- Background
moving: Ensure the sphere material uses Emission with strength
reduced and proper masking applied.
- No
shadow with static background: Ensure Mix Shader is wired correctly
with Principled BSDF assigned to the ground area.
Mini-Checklist
Session 5B — Ground, Shadows & Static Background
Goal: Make the table sit on a believable
ground with crisp shadows, then replace the moving HDRI look with a static,
clean background that still preserves shadows under the table.
1) Re‑enable the Environment Sphere (as a
backdrop/ground)
- In Outliner
→ Filter (funnel), show the monitor (Viewport) and camera
(Render) toggles.
- Turn
ON both toggles for your environment sphere (e.g., Sphere_Env) so
it’s visible in viewport and render again.
- Sneak
Peek to confirm the table no longer looks like it’s floating (it may
still look odd—shadows aren’t tuned yet).
2) Enable Global Shadows (Verge3D)
- Go
to Render Properties → Verge3D Settings.
- Enable
Shadows (leave other defaults as-is for now).
3) Enable & Tune Shadows on the Sun Light
- Select
your Sun (or the project’s main light).
- In Light
Data (bulb), enable Shadow.
- Open
Cascaded Shadow Map (CSM) and set Max Distance ≈ 20 (down
from very large defaults like 1000) to focus shadow detail near your
product.
- Reduce
Strength/Energy of the Sun to ≈ 1.0 (then fine‑tune later;
e.g., 1.7 if needed).
- Toggle
Contact Shadows ON and try:
- Bias
≈ 4.0
- Distance/Thickness
≈ 0.4
- Sneak
Peek → you should see a much clearer, grounded shadow.
Tip: If shadows still look soft or wrong, adjust Sun rotation
and Angle (larger angle = softer shadows). Keep the subject near world
origin.
4) Make the Background Static (Emission backdrop + shadow
pass)
Problem: Orbiting with an HDRI/fake dome can feel like the
background “moves.” Solution: Give the sphere a flat Emission material
so it looks static, but preserve a shadow area beneath the table via a mask
mix.
- Switch
Shader Editor to Object context and select the sphere.
- New
Material → name it M_Sphere_BG.
- Delete
the default Principled BSDF and Add → Shader → Emission.
Connect Emission → Material Output (Surface).
- Set
Emission Strength ≈ 0.5 (adjust to taste). This makes a clean,
static background—but it also kills shadows.
- Re‑introduce
ground shadows with a mask:
- Add
→ Texture → Image Texture, Open the provided ground_mask.png/.jpg
(black‑to‑white gradient).
- Add
→ Shader → Mix Shader and connect it to the Output (Surface).
- Plug
Emission into Shader 1 of the Mix.
- Add
→ Shader → Principled BSDF (default grey), plug it into Shader 2
of the Mix.
- Connect
the mask’s Color to the Mix → Fac.
- Result:
one shader for most of the sphere (Emission), and a different shader for
the ground patch (Principled) that receives shadows.
- If
the patch is inverted, either swap Emission/Principled inputs or
insert Add → Color → Invert between mask and Fac.
- Sneak
Peek: background appears flat/static, and a ground patch under the
table shows proper shadows.
Optional: UV/Mapping — If the mask isn’t positioned right,
add Input → Texture Coordinate (Object/UV) and Vector → Mapping
to scale/translate the mask until the shadow patch sits under the table.
5) Save, Export, Run
- File
→ Save.
- File
→ Export → Verge3D glTF, overwrite your app’s scene file in the
interactive-table/ folder.
- In App
Manager, Run the app and verify in the browser.
Troubleshooting
- No
shadows at all: Ensure Render Properties → Verge3D → Shadows is
enabled and the Sun’s Shadow toggle is on.
- Shadows
too faint/soft: Reduce CSM Max Distance (10–30), increase Sun Strength
slightly, or adjust Contact Shadows (Bias/Distance). Check the
ground patch is Principled, not Emission.
- Background
still looks like it’s moving: Confirm the sphere with Emission
is visible (viewport+render) and HDRI is still lighting the scene
but visually blocked by the sphere. If HDRI shows through, your
sphere may be hidden or not enclosing the camera.
- Mask
in wrong place/scale: Use Mapping node to translate/scale the
mask so the grounded area sits beneath the table.
No comments:
Post a Comment