質問するログイン新規登録

質問編集履歴

2

追記

2020/12/31 11:45

投稿

masutake0
masutake0

スコア3

title CHANGED
File without changes
body CHANGED
@@ -79,4 +79,50 @@
79
79
  「Bake」だとプレビューに影のシャドウマスクが選択でき,Assets > Scenes > SampleSceneに追加される
80
80
  ![イメージ説明](5b515dc2c402c7676b55c74f56826acf.png)
81
81
  「Realtime」だとプレビューでshadowmaskがなく影の位置がわからない
82
- ![イメージ説明](60d776412055ea89fdd3c0336f916c3c.png)
82
+ ![イメージ説明](60d776412055ea89fdd3c0336f916c3c.png)
83
+ ###追記2
84
+ ######状況
85
+ 写真の状態で実行すると模様が入った画像が出力されてしまう
86
+ ![イメージ説明](de234841d087a5b5dfc69a0ff82fcefa.png)
87
+ ![イメージ説明](cb26f4a0e582248a7935f02dc11b3d0a.png)
88
+ ######試したこと
89
+ 空のオブジェクトを作成し,作成していただいたShadowCaptorをアタッチ
90
+ ShadowCaptorにシェーダーをセット
91
+ Cubeに定期的にCapterを実行する以下のスクリプトをアタッチ
92
+ ```C#
93
+ using System.Collections;
94
+ using System.Collections.Generic;
95
+ using UnityEngine;
96
+
97
+ public class test : MonoBehaviour
98
+ {
99
+ private float timeleft;
100
+ GameObject gameobject;
101
+ Renderer cubeRenderer;
102
+ private string path;
103
+ private string fileName = "shadow.png";
104
+ private Material material;
105
+
106
+ // Start is called before the first frame update
107
+ void Start()
108
+ {
109
+ gameobject = GameObject.Find("GameObject");
110
+ path = Application.dataPath + "/" + fileName;
111
+ cubeRenderer = GetComponent<Renderer>();
112
+ }
113
+ void Update()
114
+ {
115
+ timeleft -= Time.deltaTime;
116
+ if (timeleft <= 0.0)
117
+ {
118
+ timeleft = 5.0f;
119
+
120
+ //ここに処理
121
+ gameobject.GetComponent<ShadowCaptor>().Capture(cubeRenderer, path);
122
+
123
+ }
124
+
125
+ }
126
+
127
+ }
128
+ ```

1

現況の説明

2020/12/31 11:45

投稿

masutake0
masutake0

スコア3

title CHANGED
File without changes
body CHANGED
@@ -72,4 +72,11 @@
72
72
  例えば,その座標の影を含めた色データをビルドに取得するという内容でも大丈夫です.
73
73
 
74
74
  UnityおよびC#は初心者で3日間これで頭を悩ませているので教えていただけると大変助かります.
75
- よろしくお願いします.
75
+ よろしくお願いします.
76
+
77
+
78
+ ### 追記
79
+ 「Bake」だとプレビューに影のシャドウマスクが選択でき,Assets > Scenes > SampleSceneに追加される
80
+ ![イメージ説明](5b515dc2c402c7676b55c74f56826acf.png)
81
+ 「Realtime」だとプレビューでshadowmaskがなく影の位置がわからない
82
+ ![イメージ説明](60d776412055ea89fdd3c0336f916c3c.png)