Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Atmosphere rendering for LÖVR framework

License

NotificationsYou must be signed in to change notification settings

jmiskovic/lovr-atmo

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

header screenshot

Provides a decent starting environment for sunnyLÖVR projects.

Sky rendering uses a model of the light scattering through the atmosphere with exposed parameters to modify appearance of sun and the sky. For better performance the atmosphere is rendered onto skybox texture. The color of horizon is made available so it can affect the color of fog or any other scene object.

A quick way to get this up and running is:

localatmo=require('atmo')localskybox=require('skybox').new()-- or new(512) for hi-resskybox:bake(atmo.draw)-- renders atmosphere into texturefunctionlovr.draw(pass)skybox:draw(pass)-- atmo.draw(pass) -- render directly without skyboxend

The atmosphere has some parameters that can be tweaked:

atmo.gpu.haze=0.1-- controls size of sun's haloatmo.gpu.horizon_offset=1-- moves the horizon line up or downatmo.gpu.sun_intensity=40-- brightness of sun's diskatmo.gpu.sun_sharpness=0.95-- controls the halo around the sunatmo.gpu.sun_position=Vec3(1,1,-1)-- direction, or normalized position of sun in the skyatmo.gpu.gamma_correction=2.2-- gamma for contrast and brightness adjustmentatmo.gpu.hue=Vec3(0.2,0.6,1.0)-- scattering rgb parameters that affect the overall hue

sky variations

The includedmain.lua example allows playing with atmosphere options to obtain the perfect settings. It features a basic fog model and some unrealistically scaled terrain.

A good overview of the technique can be found in theSimulating the Colors of the Sky article. Credit for the sun and atmosphere shader goes toglsl-atmosphere repository (MIT license) by Rye Terrell.

Theskybox.lua code by itself can be used for baking any scene onto the skybox. Best used for static scenes where objects are far away from camera.


[8]ページ先頭

©2009-2025 Movatter.jp