Skip to content

Commit 64041f0

Browse files
Load volume_texture.shader into Unity Engine.
1 parent 598153f commit 64041f0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

volume_texture.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
//Load volume_texture.shader into Unity Engine.
22
//Optionially, add fly script to Main Camera.
3-
3+
//This is basic template, so feel free to replace boring hash function with
4+
//own voxel structure.
45
using UnityEngine;
56

67
public class volume_texture : MonoBehaviour
@@ -21,7 +22,7 @@ Vector3 hash (Vector3 p)
2122
}
2223

2324
void GenerateVolume (int size)
24-
{
25+
{
2526
Texture3D volume = new Texture3D (size, size, size, TextureFormat.ARGB32, true);
2627
var voxels = new Color[size*size*size];
2728
int i = 0;
@@ -42,7 +43,7 @@ void GenerateVolume (int size)
4243
volume.SetPixels (voxels);
4344
volume.Apply ();
4445
material.SetTexture("volume",volume);
45-
}
46+
}
4647

4748
void Start ()
4849
{

0 commit comments

Comments
 (0)