Skip to content

Commit

Permalink
Ray Marching 3D & Images
Browse files Browse the repository at this point in the history
- soft shadows & better lighting for Ray Marching 3D
- descriptions and introduction in main menu
- more images
  • Loading branch information
srpnt3 committed Jul 14, 2020
1 parent b7c542b commit 92b9ad4
Show file tree
Hide file tree
Showing 56 changed files with 751 additions and 504 deletions.
215 changes: 213 additions & 2 deletions Fractals Project/Assets/Scenes/RayMarching3D.unity
Original file line number Diff line number Diff line change
Expand Up @@ -487,6 +487,216 @@ CanvasRenderer:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 907002857}
m_CullTransparentMesh: 0
--- !u!1001 &908585213
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 1149578827}
m_Modifications:
- target: {fileID: 1452083679841220395, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
propertyPath: m_textInfo.characterCount
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1452083679841220395, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
propertyPath: m_textInfo.wordCount
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1452083679841220395, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
propertyPath: m_textInfo.lineCount
value: 0
objectReference: {fileID: 0}
- target: {fileID: 1452083679841220395, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
propertyPath: m_textInfo.pageCount
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2886464298844970360, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
propertyPath: app
value:
objectReference: {fileID: 1663493760}
- target: {fileID: 2886464298844970360, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
propertyPath: optionName
value: O_Shadows
objectReference: {fileID: 0}
- target: {fileID: 2886464298844970360, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
propertyPath: min
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2886464298844970360, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
propertyPath: max
value: 256
objectReference: {fileID: 0}
- target: {fileID: 3020254205512028578, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
propertyPath: m_textInfo.characterCount
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3020254205512028578, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
propertyPath: m_textInfo.wordCount
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3020254205512028578, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
propertyPath: m_textInfo.lineCount
value: 0
objectReference: {fileID: 0}
- target: {fileID: 3020254205512028578, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
propertyPath: m_textInfo.pageCount
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4412081283395472661, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
propertyPath: m_textInfo.characterCount
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4412081283395472661, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
propertyPath: m_textInfo.wordCount
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4412081283395472661, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
propertyPath: m_textInfo.lineCount
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4412081283395472661, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
propertyPath: m_textInfo.pageCount
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4412081283409038069, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
propertyPath: m_AnchorMax.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4412081284719302608, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4412081284719302608, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4412081284719302608, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4412081284719302608, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
propertyPath: m_LocalRotation.x
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4412081284719302608, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
propertyPath: m_LocalRotation.y
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4412081284719302608, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
propertyPath: m_LocalRotation.z
value: -0
objectReference: {fileID: 0}
- target: {fileID: 4412081284719302608, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4412081284719302608, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
- target: {fileID: 4412081284719302608, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4412081284719302608, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4412081284719302608, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4412081284719302608, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
propertyPath: m_AnchoredPosition.x
value: 150
objectReference: {fileID: 0}
- target: {fileID: 4412081284719302608, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
propertyPath: m_AnchoredPosition.y
value: -237.5
objectReference: {fileID: 0}
- target: {fileID: 4412081284719302608, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
propertyPath: m_SizeDelta.x
value: 300
objectReference: {fileID: 0}
- target: {fileID: 4412081284719302608, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
propertyPath: m_SizeDelta.y
value: 63
objectReference: {fileID: 0}
- target: {fileID: 4412081284719302608, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
propertyPath: m_AnchorMin.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4412081284719302608, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
propertyPath: m_AnchorMin.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4412081284719302608, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
propertyPath: m_AnchorMax.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4412081284719302608, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
propertyPath: m_AnchorMax.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4412081284719302608, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
propertyPath: m_Pivot.x
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 4412081284719302608, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
propertyPath: m_Pivot.y
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 4412081284719302609, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
propertyPath: m_Name
value: Shadows
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 1f834fe602c595649a57bd478ffa5942, type: 3}
--- !u!224 &908585214 stripped
RectTransform:
m_CorrespondingSourceObject: {fileID: 4412081284719302608, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
m_PrefabInstance: {fileID: 908585213}
m_PrefabAsset: {fileID: 0}
--- !u!1 &1040080491
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -583,6 +793,7 @@ RectTransform:
m_Children:
- {fileID: 2014194723}
- {fileID: 1400122513}
- {fileID: 908585214}
m_Father: {fileID: 1528141819}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
Expand Down Expand Up @@ -1024,7 +1235,7 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1663493755}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -2}
m_LocalPosition: {x: 0, y: 1, z: -2}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
Expand Down Expand Up @@ -1496,7 +1707,7 @@ PrefabInstance:
- target: {fileID: 2886464298844970360, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
propertyPath: min
value: 10
value: 30
objectReference: {fileID: 0}
- target: {fileID: 4412081283409038069, guid: 1f834fe602c595649a57bd478ffa5942,
type: 3}
Expand Down
4 changes: 2 additions & 2 deletions Fractals Project/Assets/Scenes/_Loading.unity
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ Camera:
m_GameObject: {fileID: 1417164539}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 2
m_ClearFlags: 4
m_BackGroundColor: {r: 0.11372549, g: 0.12156863, b: 0.16470589, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
Expand All @@ -355,7 +355,7 @@ Camera:
m_Depth: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_Bits: 32
m_RenderingPath: 3
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
Expand Down
26 changes: 13 additions & 13 deletions Fractals Project/Assets/Scenes/_MainMenu.unity
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: 2D
m_text: '-'
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 59f3347b320f8524086c941a658f4e3b, type: 2}
m_sharedMaterial: {fileID: 300501400175477300, guid: 59f3347b320f8524086c941a658f4e3b,
Expand Down Expand Up @@ -293,7 +293,7 @@ MonoBehaviour:
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_textInfo:
textComponent: {fileID: 59568240}
characterCount: 2
characterCount: 1
spriteCount: 0
spaceCount: 0
wordCount: 1
Expand Down Expand Up @@ -1380,7 +1380,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: 825 MB
m_text: '-'
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 59f3347b320f8524086c941a658f4e3b, type: 2}
m_sharedMaterial: {fileID: 300501400175477300, guid: 59f3347b320f8524086c941a658f4e3b,
Expand Down Expand Up @@ -1450,10 +1450,10 @@ MonoBehaviour:
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_textInfo:
textComponent: {fileID: 735536350}
characterCount: 6
characterCount: 1
spriteCount: 0
spaceCount: 1
wordCount: 2
spaceCount: 0
wordCount: 1
linkCount: 0
lineCount: 1
pageCount: 1
Expand Down Expand Up @@ -2209,7 +2209,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: 05 FEB
m_text: '-'
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 59f3347b320f8524086c941a658f4e3b, type: 2}
m_sharedMaterial: {fileID: 300501400175477300, guid: 59f3347b320f8524086c941a658f4e3b,
Expand Down Expand Up @@ -2279,10 +2279,10 @@ MonoBehaviour:
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_textInfo:
textComponent: {fileID: 1234476291}
characterCount: 6
characterCount: 1
spriteCount: 0
spaceCount: 1
wordCount: 2
spaceCount: 0
wordCount: 1
linkCount: 0
lineCount: 1
pageCount: 1
Expand Down Expand Up @@ -2827,7 +2827,7 @@ MonoBehaviour:
m_PersistentCalls:
m_Calls:
- m_Target: {fileID: 496216226}
m_MethodName: SetSelected
m_MethodName: set_Selected
m_Mode: 3
m_Arguments:
m_ObjectArgument: {fileID: 0}
Expand Down Expand Up @@ -3708,7 +3708,7 @@ MonoBehaviour:
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_text: Mandelbrot
m_text: Title
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 6638258ddc4d85f468270400b9a0214a, type: 2}
m_sharedMaterial: {fileID: 4290382322653429124, guid: 6638258ddc4d85f468270400b9a0214a,
Expand Down Expand Up @@ -3778,7 +3778,7 @@ MonoBehaviour:
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_textInfo:
textComponent: {fileID: 1826455125}
characterCount: 10
characterCount: 5
spriteCount: 0
spaceCount: 0
wordCount: 1
Expand Down
6 changes: 3 additions & 3 deletions Fractals Project/Assets/Scripts/Mandelbrot/Mandelbrot.compute
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ Cmplx Multiply(Cmplx a, Cmplx b) {
return x;
}

double GetAbsolute(Cmplx x) {
return sqrt(x.re * x.re + x.im * x.im);
float GetAbsolute(Cmplx x) {
return sqrt(float(x.re * x.re) + float(x.im * x.im));
}

// the math
Expand Down Expand Up @@ -80,6 +80,6 @@ void CSMain(uint3 id : SV_DispatchThreadID) {
uint c, s; Colors.GetDimensions(c, s); // get the size of the array
int x = a * (c - 1); // calculate the index
float3 clr = Colors[x]; // get the corresponding color
Texture[id.xy] = float4(clr[0], clr[1], clr[2], 1); // apply
Texture[id.xy] = float4(clr, 1); // apply
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ void CSMain (uint3 id : SV_DispatchThreadID) {
Ray ray = CreateCameraRay(uv);

float2 res = March(ray);
float4 ao = res.x * float4(0.1, 0.74, 0.61, res.y / 10.0);
float4 ao = res.x * float4(0.3, 0.6, 0.7, res.y / 10.0);
float4 fog = 1 / (res.y + 1);
Texture[id.xy] = Source[id.xy] + ao;
//Texture[id.xy] = fog;
Expand Down
Loading

0 comments on commit 92b9ad4

Please sign in to comment.