Skip to content

Conversation

@adeniyii
Copy link

Summary

Adds a new ambient option to control the base illumination level of the globe. This allows users to fine-tune the globe's brightness to better blend with their backgrounds.

Motivation

Closes #102

Currently, the globe has a hardcoded ambient lighting value of 0.1, which makes it difficult to:

  • Blend the globe seamlessly with dark backgrounds
  • Achieve a truly dark appearance when desired
  • Fine-tune the globe's brightness for different design contexts

Changes

  • Add ambient uniform to shader (src/shader.frag)
  • Expose ambient option in createGlobe with default of 0.1 (src/index.js)
  • Add ambient to TypeScript definitions (src/index.d.ts)

Backward Compatibility

The default value of 0.1 maintains full backward compatibility with existing implementations. No breaking changes.

Usage Example

const globe = createGlobe(canvas, {
  // ... other options
  ambient: 0.05,  // Subtle ambient light for dark backgrounds
  // or ambient: 0 for completely dark
  // or keep default 0.1 for original behavior
})

Testing

Tested locally with various ambient values (0, 0.05, 0.1) on both light and dark backgrounds.

Add a new 'ambient' option to control the base illumination level of the
globe. This allows users to fine-tune the globe's brightness to better
blend with their backgrounds.

The ambient value defaults to 0.1 to maintain backward compatibility with
existing implementations. Users can now set it to lower values (e.g., 0.05
or 0) for darker globes, or higher values for more illumination.

Changes:
- Add 'ambient' uniform to shader (src/shader.frag)
- Expose 'ambient' option in createGlobe with default of 0.1 (src/index.js)
- Add 'ambient' to TypeScript definitions (src/index.d.ts)

Closes shuding#102
@vercel
Copy link

vercel bot commented Oct 28, 2025

@adeniyii is attempting to deploy a commit to the shu Team on Vercel.

A member of the Team first needs to authorize it.

@vercel
Copy link

vercel bot commented Oct 31, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
cobe Ready Ready Preview Comment Oct 31, 2025 10:56am

@shuding
Copy link
Owner

shuding commented Oct 31, 2025

Thanks for the PR, can you remove the dist/ folder and also update the playground (under website/)?

@adeniyii adeniyii force-pushed the feat/configurable-ambient-lighting branch from 349c961 to aedc426 Compare November 3, 2025 15:02
@adeniyii
Copy link
Author

adeniyii commented Nov 3, 2025

@shuding all done, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add configurable ambient lighting option

2 participants