이 페이지에서는 Stingray 편집기에서, 그리고 런타임 시 게임에서 동적으로 음영처리 환경의 특성을 변경하기 위한 옵션에 대해 설명합니다.
Explorer 패널에서 음영처리 환경 엔티티를 선택하고 Property Editor에서 특성을 변경합니다. 변경 사항은 편집기에 즉시 적용되고, 수준을 저장할 때 저장됩니다.
Story Editor를 사용하여 수준 음영처리 환경의 특성을 애니메이트하는 스토리를 생성할 수 있습니다. 시간에 따라 다양한 특성을 입력하여 시간 변경, 위치 변경 등 다양한 시나리오나 효과를 시뮬레이션할 수 있습니다. 런타임 시 흐름 또는 Lua 게임 플레이 코드에서 트리거하여 스토리를 재생하면 음영처리 환경이 이에 따라 자체적으로 조정되는 모습이 보입니다.
Story Editor를 사용하여 음영처리 환경 애니메이션을 참조하십시오.
참고: 이러한 옵션을 조정해도 Asset Preview 창에서 렌더링이 변경되지 않습니다.
수준의 음영처리 환경 엔티티를 검색하여 런타임 Lua 코드에서 특성을 변경할 수 있습니다. 예를 들어, 다음 코드는 Exposure 특성에 새 값을 설정하는 방법을 보여줍니다.
local data_component_manager = stingray.EntityManager.render_data_component(SimpleProject.world) local all_entity_handles = stingray.World.entities(SimpleProject.world) -- iterate through all entities in the world. for _, entity_handle in ipairs(all_entity_handles) do -- the shading environment is a render data component, so we retrieve all render data components -- owned by this entity and iterate through them. -- instances() returns the values on the stack, so we wrap the call in {} to get an array. local all_data_component_handles = {stingray.RenderDataComponent.instances(data_component_manager, entity_handle)} for _, data_component_handle in ipairs(all_data_component_handles) do -- Test whether or not this data component is the shading environment component -- that we want to modify. -- Missing properties return nil, so this is "safe". local shading_environment_mapping_resource_name = stingray.RenderDataComponent.get_property(data_component_manager, data_component_handle, {"shading_environment_mapping"}) if shading_environment_mapping_resource_name == "core/stingray_renderer/shading_environment_components/exposure" then if (shading_env_entity == nil) then -- remember the shading environment entity. shading_env_entity = entity_handle end exposure_component = data_component_handle; -- now we have the shading environment entity and the component, we can set the -- value we want for the property. stingray.RenderDataComponent.set_property(data_component_manager, exposure_component, {"exposure"}, exposure_val) end end end
다양한 특성에 액세스하는 데 사용하는 이름은 코어 리소스 폴더의 core/stingray_renderer/shading_environment_components에서 찾을 수 있는 리소스 매핑 파일에 의해 결정됩니다. 음영처리 환경의 구성요소에 해당하는 매핑 파일을 열고, 설정하려는 특성에 해당하는 키의 이름을 찾습니다.