how to draw a colum only use one draw call?would it be better to draw multiple colunm and row in one draw?
Closed this issue · 2 comments
this project is an amazing works!
but what confuse me is that you use only draw call to draw a whole column,
i assume it's beacause you use tex2d in position shader,but i tired in my own custom shader,it did'nt work. i use a noise textrue,but it only make my mesh's vertexs get a random diplacement effect, can't draw mutiple meshes.
so just a thought of me ,now you use single draw to drwa mutiple mesh , what if you draw mutile column and rows,would it be better?
and a little advice , use sepreate size variables for the debug textrue, in some case the debug shader could be very small on screen, so you can scale it like this
void OnGUI() { if (_debug && Event.current.type.Equals(EventType.Repaint)) { if (_debugMaterial && _positionBuffer && _rotationBuffer && _scaleBuffer) { var rect = new Rect(0, 0, _debugcolumns, _debugrows); Graphics.DrawTexture(rect, _positionBuffer, _debugMaterial); rect.y += _debugrows; Graphics.DrawTexture(rect, _rotationBuffer, _debugMaterial); rect.y += _debugrows; Graphics.DrawTexture(rect, _scaleBuffer, _debugMaterial); } } }
` void OnGUI()
{
if (_debug && Event.current.type.Equals(EventType.Repaint))
{
if (_debugMaterial && _positionBuffer && _rotationBuffer && _scaleBuffer)
{
var rect = new Rect(0, 0, _debugcolumns, _debugrows);
Graphics.DrawTexture(rect, _positionBuffer, _debugMaterial);
rect.y += _debugrows;
Graphics.DrawTexture(rect, _rotationBuffer, _debugMaterial);
rect.y += _debugrows;
Graphics.DrawTexture(rect, _scaleBuffer, _debugMaterial);
}
}
}`
Yes, it might be better if it's done with a single draw call. However, it will introduce extra complexity and instability to the code. I didn't have enough time for tackling it, so abandoned that idea.