Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Removed BOM from some files. - Changed linefeed type to Unix. - chmod a-x
- Loading branch information
Keijiro Takahashi
authored and
Keijiro Takahashi
committed
Jun 26, 2016
1 parent
d9b428e
commit 932bb30
Showing
17 changed files
with
434 additions
and
417 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Auto detect text files and perform LF normalization | ||
* text=auto | ||
|
||
# Custom for Visual Studio | ||
*.cs diff=csharp | ||
|
||
# Standard to msysgit | ||
*.doc diff=astextplain | ||
*.DOC diff=astextplain | ||
*.docx diff=astextplain | ||
*.DOCX diff=astextplain | ||
*.dot diff=astextplain | ||
*.DOT diff=astextplain | ||
*.pdf diff=astextplain | ||
*.PDF diff=astextplain | ||
*.rtf diff=astextplain | ||
*.RTF diff=astextplain |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,136 +1,136 @@ | ||
// | ||
// Deferred AO - SSAO image effect for deferred shading | ||
// | ||
// Copyright (C) 2015 Keijiro Takahashi | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
// this software and associated documentation files (the "Software"), to deal in | ||
// the Software without restriction, including without limitation the rights to | ||
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
// the Software, and to permit persons to whom the Software is furnished to do so, | ||
// subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in all | ||
// copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
// | ||
using UnityEngine; | ||
|
||
[ExecuteInEditMode] | ||
[RequireComponent(typeof(Camera))] | ||
[AddComponentMenu("Image Effects/Rendering/Deferred AO")] | ||
public class DeferredAO : MonoBehaviour | ||
{ | ||
#region Public Properties | ||
|
||
// Effect intensity | ||
|
||
[SerializeField] | ||
float _intensity = 1; | ||
|
||
public float intensity { | ||
get { return _intensity; } | ||
set { _intensity = value; } | ||
} | ||
|
||
// Sample radius | ||
|
||
[SerializeField] | ||
float _sampleRadius = 1; | ||
|
||
public float sampleRadius { | ||
get { return _sampleRadius; } | ||
set { _sampleRadius = value; } | ||
} | ||
|
||
// Range check (rejects distant samples) | ||
|
||
[SerializeField] | ||
bool _rangeCheck = true; | ||
|
||
public bool rangeCheck { | ||
get { return _rangeCheck; } | ||
set { _rangeCheck = value; } | ||
} | ||
|
||
// Fall-off distance | ||
|
||
[SerializeField] | ||
float _fallOffDistance = 100; | ||
|
||
public float fallOffDistance { | ||
get { return _fallOffDistance; } | ||
set { _fallOffDistance = value; } | ||
} | ||
|
||
// Sample count | ||
|
||
public enum SampleCount { Low, Medium, High, Overkill } | ||
|
||
[SerializeField] | ||
SampleCount _sampleCount = SampleCount.Medium; | ||
|
||
public SampleCount sampleCount { | ||
get { return _sampleCount; } | ||
set { _sampleCount = value; } | ||
} | ||
|
||
#endregion | ||
|
||
#region Private Resources | ||
|
||
[SerializeField] | ||
Shader _shader; | ||
|
||
Material _material; | ||
|
||
bool CheckDeferredShading() | ||
{ | ||
var path = GetComponent<Camera>().actualRenderingPath; | ||
return path == RenderingPath.DeferredShading; | ||
} | ||
|
||
#endregion | ||
|
||
#region MonoBehaviour Functions | ||
|
||
[ImageEffectOpaque] | ||
void OnRenderImage(RenderTexture source, RenderTexture destination) | ||
{ | ||
if (!CheckDeferredShading()) { | ||
Graphics.Blit(source, destination); | ||
return; | ||
} | ||
|
||
if (_material == null) { | ||
_material = new Material(_shader); | ||
_material.hideFlags = HideFlags.DontSave; | ||
} | ||
|
||
_material.SetFloat("_Radius", _sampleRadius); | ||
_material.SetFloat("_Intensity", _intensity); | ||
_material.SetFloat("_FallOff", _fallOffDistance); | ||
|
||
_material.shaderKeywords = null; | ||
|
||
if (_rangeCheck) | ||
_material.EnableKeyword("_RANGE_CHECK"); | ||
|
||
if (_sampleCount == SampleCount.Medium) | ||
_material.EnableKeyword("_SAMPLE_MEDIUM"); | ||
else if (_sampleCount == SampleCount.High) | ||
_material.EnableKeyword("_SAMPLE_HIGH"); | ||
else if (_sampleCount == SampleCount.Overkill) | ||
_material.EnableKeyword("_SAMPLE_OVERKILL"); | ||
|
||
Graphics.Blit(source, destination, _material, 0); | ||
} | ||
|
||
#endregion | ||
} | ||
// | ||
// Deferred AO - SSAO image effect for deferred shading | ||
// | ||
// Copyright (C) 2015 Keijiro Takahashi | ||
// | ||
// Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
// this software and associated documentation files (the "Software"), to deal in | ||
// the Software without restriction, including without limitation the rights to | ||
// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
// the Software, and to permit persons to whom the Software is furnished to do so, | ||
// subject to the following conditions: | ||
// | ||
// The above copyright notice and this permission notice shall be included in all | ||
// copies or substantial portions of the Software. | ||
// | ||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
// | ||
using UnityEngine; | ||
|
||
[ExecuteInEditMode] | ||
[RequireComponent(typeof(Camera))] | ||
[AddComponentMenu("Image Effects/Rendering/Deferred AO")] | ||
public class DeferredAO : MonoBehaviour | ||
{ | ||
#region Public Properties | ||
|
||
// Effect intensity | ||
|
||
[SerializeField] | ||
float _intensity = 1; | ||
|
||
public float intensity { | ||
get { return _intensity; } | ||
set { _intensity = value; } | ||
} | ||
|
||
// Sample radius | ||
|
||
[SerializeField] | ||
float _sampleRadius = 1; | ||
|
||
public float sampleRadius { | ||
get { return _sampleRadius; } | ||
set { _sampleRadius = value; } | ||
} | ||
|
||
// Range check (rejects distant samples) | ||
|
||
[SerializeField] | ||
bool _rangeCheck = true; | ||
|
||
public bool rangeCheck { | ||
get { return _rangeCheck; } | ||
set { _rangeCheck = value; } | ||
} | ||
|
||
// Fall-off distance | ||
|
||
[SerializeField] | ||
float _fallOffDistance = 100; | ||
|
||
public float fallOffDistance { | ||
get { return _fallOffDistance; } | ||
set { _fallOffDistance = value; } | ||
} | ||
|
||
// Sample count | ||
|
||
public enum SampleCount { Low, Medium, High, Overkill } | ||
|
||
[SerializeField] | ||
SampleCount _sampleCount = SampleCount.Medium; | ||
|
||
public SampleCount sampleCount { | ||
get { return _sampleCount; } | ||
set { _sampleCount = value; } | ||
} | ||
|
||
#endregion | ||
|
||
#region Private Resources | ||
|
||
[SerializeField] | ||
Shader _shader; | ||
|
||
Material _material; | ||
|
||
bool CheckDeferredShading() | ||
{ | ||
var path = GetComponent<Camera>().actualRenderingPath; | ||
return path == RenderingPath.DeferredShading; | ||
} | ||
|
||
#endregion | ||
|
||
#region MonoBehaviour Functions | ||
|
||
[ImageEffectOpaque] | ||
void OnRenderImage(RenderTexture source, RenderTexture destination) | ||
{ | ||
if (!CheckDeferredShading()) { | ||
Graphics.Blit(source, destination); | ||
return; | ||
} | ||
|
||
if (_material == null) { | ||
_material = new Material(_shader); | ||
_material.hideFlags = HideFlags.DontSave; | ||
} | ||
|
||
_material.SetFloat("_Radius", _sampleRadius); | ||
_material.SetFloat("_Intensity", _intensity); | ||
_material.SetFloat("_FallOff", _fallOffDistance); | ||
|
||
_material.shaderKeywords = null; | ||
|
||
if (_rangeCheck) | ||
_material.EnableKeyword("_RANGE_CHECK"); | ||
|
||
if (_sampleCount == SampleCount.Medium) | ||
_material.EnableKeyword("_SAMPLE_MEDIUM"); | ||
else if (_sampleCount == SampleCount.High) | ||
_material.EnableKeyword("_SAMPLE_HIGH"); | ||
else if (_sampleCount == SampleCount.Overkill) | ||
_material.EnableKeyword("_SAMPLE_OVERKILL"); | ||
|
||
Graphics.Blit(source, destination, _material, 0); | ||
} | ||
|
||
#endregion | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.