Skip to content

Commit

Permalink
update ouchi
Browse files Browse the repository at this point in the history
  • Loading branch information
syKevinPeng committed Apr 15, 2024
1 parent d79412c commit 1656912
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 27 deletions.
Binary file modified Assets/SavedTextures/pattern.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
49 changes: 26 additions & 23 deletions Assets/Scenes/SampleScene.unity
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ RenderSettings:
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 705507994}
m_IndirectSpecularColor: {r: 0.18028378, g: 0.22571412, b: 0.30692285, a: 1}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0.12731749, g: 0.13414757, b: 0.1210787, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
Expand Down Expand Up @@ -222,42 +222,42 @@ Transform:
m_Father: {fileID: 864835256}
m_RootOrder: 7
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &705507993
--- !u!1 &711683826
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 705507995}
- component: {fileID: 705507994}
- component: {fileID: 711683828}
- component: {fileID: 711683827}
m_Layer: 0
m_Name: Directional Light
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!108 &705507994
--- !u!108 &711683827
Light:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 705507993}
m_GameObject: {fileID: 711683826}
m_Enabled: 1
serializedVersion: 10
m_Type: 1
m_Type: 0
m_Shape: 0
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
m_Intensity: 1
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_Intensity: 1.5
m_Range: 10
m_SpotAngle: 30
m_InnerSpotAngle: 21.80208
m_SpotAngle: 19.4
m_InnerSpotAngle: 19.4
m_CookieSize: 10
m_Shadows:
m_Type: 2
m_Type: 0
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
Expand Down Expand Up @@ -290,7 +290,7 @@ Light:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingLayerMask: 1
m_Lightmapping: 1
m_Lightmapping: 4
m_LightShadowCasterMode: 0
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
Expand All @@ -301,21 +301,21 @@ Light:
m_UseViewFrustumForShadowCasterCull: 1
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &705507995
--- !u!4 &711683828
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 705507993}
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 0, y: 3, z: 0}
m_GameObject: {fileID: 711683826}
m_LocalRotation: {x: 0.06975647, y: 0, z: 0, w: 0.9975641}
m_LocalPosition: {x: 0, y: 1.49, z: -5}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 8, y: 0, z: 0}
--- !u!1 &758907210
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -350,6 +350,9 @@ MonoBehaviour:
m_EditorClassIdentifier:
displayPlane: {fileID: 758907210}
material: {fileID: 2100000, guid: aabf485777cb02d448f101c03e01533a, type: 2}
PatternHeight: 8
PatternWidth: 64
radius: 100
--- !u!64 &758907212
MeshCollider:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -422,12 +425,12 @@ Transform:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 758907210}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0.02, y: 0.25, z: 3.199}
m_LocalPosition: {x: 0.02, y: 0.25, z: 1.41}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 2
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!4 &830939339 stripped
Transform:
Expand All @@ -452,7 +455,7 @@ PrefabInstance:
objectReference: {fileID: 0}
- target: {fileID: 400004, guid: 126d619cf4daa52469682f85c1378b4a, type: 3}
propertyPath: m_RootOrder
value: 1
value: 0
objectReference: {fileID: 0}
- target: {fileID: 400004, guid: 126d619cf4daa52469682f85c1378b4a, type: 3}
propertyPath: m_LocalPosition.x
Expand Down
23 changes: 19 additions & 4 deletions Assets/Scripts/ouchi.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
Expand All @@ -11,19 +12,33 @@ public class ouchi : MonoBehaviour
public GameObject displayPlane;
public Material material;
private Texture2D texture;
public int PatternHeight = 64;
public int PatternWidth = 64;
public int PatternHeight;
public int PatternWidth;
public int radius = 150;

void GeneratePattern()
{
texture = new Texture2D(width, height);

// define the background pattern
for (int h = 0; h < height; h++)
for (int w = 0; w < width; w++)
{
texture.SetPixel(w, h, (w / PatternWidth % 2 == h / PatternHeight % 2) ? Color.white : Color.black);
}
// define the center circular pattern
int centerX = width / 2;
int centerY = height / 2;
for (int h = 0; h < height; h++)
for (int w = 0; w < width; w++)
{
texture.SetPixel(w, h, ((w / PatternWidth) % 2 == (h / PatternHeight) % 2) ? Color.white : Color.red);
if (Mathf.Pow(w - centerX, 2) + Mathf.Pow(h - centerY, 2) < Mathf.Pow(radius, 2))
{
// texture.SetPixel(w, h, Color.red);
texture.SetPixel(h, w, ((w / PatternWidth) % 2 == (h / PatternHeight) % 2) ? Color.black : Color.white);
}
}


texture.filterMode = FilterMode.Point;
texture.Apply();
material.mainTexture = texture;
Expand Down

0 comments on commit 1656912

Please sign in to comment.