Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
207 changes: 207 additions & 0 deletions Assets/Resources/Prefabs/Light - Insert.prefab
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &550864702806823459
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 2649789736405374282}
- component: {fileID: 4750229237398323307}
m_Layer: 0
m_Name: Light - Insert
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &2649789736405374282
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 550864702806823459}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 179995335602121591}
- {fileID: 4222681214933490337}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &4750229237398323307
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 550864702806823459}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9e53d77b7d585c94b89513d95571354e, type: 3}
m_Name:
m_EditorClassIdentifier:
_isLocked: 0
_editorLayer: 0
_editorLayerName:
_editorLayerVisibility: 1
Position: {x: 0, y: 0, z: 0}
_surface: {fileID: 0}
BulbSize: 20
State: 0
BlinkPattern:
BlinkInterval: 0
FadeSpeedUp: 0
FadeSpeedDown: 0
--- !u!1 &5987759878404274838
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 179995335602121591}
- component: {fileID: 4762606870770787496}
- component: {fileID: 5251209611439210537}
m_Layer: 0
m_Name: Insert
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &179995335602121591
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5987759878404274838}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -0, y: -0, z: 0.1}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 2649789736405374282}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &4762606870770787496
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5987759878404274838}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e2a11a120b7da4b4db6fd330516311db, type: 3}
m_Name:
m_EditorClassIdentifier:
InsertHeight: 20
PositionZ: 0.1
_dragPoints: []
--- !u!33 &5251209611439210537
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5987759878404274838}
m_Mesh: {fileID: 0}
--- !u!1 &7031967719973800860
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 4222681214933490337}
- component: {fileID: 1799189321192003275}
m_Layer: 0
m_Name: Source
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &4222681214933490337
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7031967719973800860}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -50}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 2649789736405374282}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!108 &1799189321192003275
Light:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7031967719973800860}
m_Enabled: 1
serializedVersion: 10
m_Type: 0
m_Shape: 0
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Intensity: 1155.2686
m_Range: 0.1
m_SpotAngle: 75
m_InnerSpotAngle: 1
m_CookieSize: 10
m_Shadows:
m_Type: 0
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_CullingMatrixOverride:
e00: 1
e01: 0
e02: 0
e03: 0
e10: 0
e11: 1
e12: 0
e13: 0
e20: 0
e21: 0
e22: 1
e23: 0
e30: 0
e31: 0
e32: 0
e33: 1
m_UseCullingMatrixOverride: 0
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingLayerMask: 1
m_Lightmapping: 4
m_LightShadowCasterMode: 2
m_AreaSize: {x: 0.5, y: 0.5}
m_BounceIntensity: 1
m_ColorTemperature: 2700
m_UseColorTemperature: 1
m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
m_UseBoundingSphereOverride: 0
m_UseViewFrustumForShadowCasterCull: 1
m_ShadowRadius: 0.01
m_ShadowAngle: 0
7 changes: 7 additions & 0 deletions Assets/Resources/Prefabs/Light - Insert.prefab.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

56 changes: 0 additions & 56 deletions Assets/Resources/Prefabs/Light.prefab
Original file line number Diff line number Diff line change
Expand Up @@ -93,61 +93,6 @@ Light:
m_UseViewFrustumForShadowCasterCull: 1
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!1 &6668087499752519847
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 668676724496252522}
- component: {fileID: 4270132360562549902}
- component: {fileID: 8432211507712617245}
m_Layer: 0
m_Name: Insert
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &668676724496252522
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6668087499752519847}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 8610125003353710624}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &4270132360562549902
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6668087499752519847}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: e2a11a120b7da4b4db6fd330516311db, type: 3}
m_Name:
m_EditorClassIdentifier:
InsertHeight: 20
PositionZ: 0
_dragPoints: []
--- !u!33 &8432211507712617245
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 6668087499752519847}
m_Mesh: {fileID: 0}
--- !u!1 &6671583051311971504
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -179,7 +124,6 @@ Transform:
- {fileID: 87034997330278711}
- {fileID: 3512352900261141159}
- {fileID: 1496204463163538612}
- {fileID: 668676724496252522}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
Expand Down
43 changes: 40 additions & 3 deletions Runtime/LightConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ namespace VisualPinball.Unity.Urp
{
public class LightConverter : ILightConverter
{
public void UpdateLight(Light light, LightData data)
public void UpdateLight(Light light, LightData data, bool isInsert)
{
// Set color and position
light.color = data.Color2.ToUnityColor();
Expand All @@ -35,9 +35,46 @@ public void UpdateLight(Light light, LightData data)
light.transform.localPosition = new Vector3(0f, 0f, 25f);

// TODO: vpe specific shadow settings
light.shadows = LightShadows.Hard;
light.shadows = LightShadows.None;
light.shadowBias = 0f;
light.shadowNearPlane = 0f;
light.shadowNearPlane = 0.001f;
}

public void SetColor(Light light, Color color)
{
light.color = color;
}

public void SetShadow(Light light, bool enabled, bool isDynamic, float nearPlane = 0.01f)
{
// light.shadows = enabled ? LightShadows.Soft : LightShadows.None;
// light.shadowNearPlane = nearPlane;
}
public void SetRange(Light light, float range)
{
light.range = range;
}

public void SetIntensity(Light light, float intensityLumen)
{
//light.intensity = intensityLumen / 1000f;
}


public void SetTemperature(Light light, float temperature)
{
// todo
}

public void SpotLight(Light light, float outer, float innerPercent)
{
light.spotAngle = outer;
light.innerSpotAngle = outer * innerPercent * 0.01f;
}

public void PyramidAngle(Light light, float angle, float aspectRatio)
{
// urp has no pyramid spot light
}
}
}
18 changes: 16 additions & 2 deletions Runtime/MaterialConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
using UnityEngine;
using VisualPinball.Engine.VPT;
using Material = UnityEngine.Material;
using Mesh = VisualPinball.Engine.VPT.Mesh;

namespace VisualPinball.Unity.Urp
{
Expand Down Expand Up @@ -109,7 +108,7 @@ public Material CreateMaterial(PbrMaterial vpxMaterial, ITextureProvider texture
unityMaterial.SetFloat(Metallic, metallicValue);

// roughness / glossiness
unityMaterial.SetFloat(Smoothness, vpxMaterial.Roughness);
SetSmoothness(unityMaterial, vpxMaterial.Roughness);

// map
if (vpxMaterial.HasMap) {
Expand All @@ -127,6 +126,11 @@ public Material CreateMaterial(PbrMaterial vpxMaterial, ITextureProvider texture
return unityMaterial;
}

public void SetSmoothness(Material material, float smoothness)
{
material.SetFloat(Smoothness, smoothness);
}

public Material MergeMaterials(PbrMaterial vpxMaterial, Material texturedMaterial)
{
var nonTexturedMaterial = CreateMaterial(vpxMaterial, null);
Expand All @@ -140,5 +144,15 @@ public Material MergeMaterials(PbrMaterial vpxMaterial, Material texturedMateria

return mergedMaterial;
}

public void SetDiffusionProfile(Material material, DiffusionProfileTemplate template)
{
// todo
}

public void SetMaterialType(Material material, MaterialType materialType)
{
// todo
}
}
}
Loading