Hot answers tagged

2

No. The size of the array has to be a constant. Specifically from the GLSL specification: 4.1.9 Arrays ... When an array size is specified in a declaration, it must be an integral constant expression (see Section 4.3.3 “Constant Expressions” ) greater than zero.


2

I was able to eliminate all of the GpuProgram warnings and also fix all of my animations by trial and error elimination of several shaders and additionally re-importing the models from Blender. Steps as follows. I set all of the models to use the standard shader in Unity. I then deleted and reloaded the offending shaders and did not have any errors, this ...


2

I think unity can use stencil buffer though I never used it, if you are not able to do that I'll investigate deeper, One way to achieve that is to cut-out pieces of walls using some lowpoly spheres and stencil buffer, then fill that holes with an "hole" 3d model, so ask an artist to make a hole model wich looks like a cone so it can fir in a variety of holes ...


1

I accidentally stumbled upon a template for the shaders in Monogame installation directory and replaced the shader with this one: #define SV_POSITION POSITION #define VS_SHADERMODEL vs_3_0 #define PS_SHADERMODEL ps_4_0_level_9_1 Texture2D SpriteTexture; sampler2D SpriteTextureSampler = sampler_state { Texture = <SpriteTexture>; }; struct ...


1

Don't use worldspace, use screenspace See 1 See, if you use World Space, what happens when an object gets closer to the camera than your arbitrary sprite distance? Why, it renders in front of the UI. This is bad. Secondly, if you're using GL calls, GL natively works in Screen Space, you actually have to perform counteracting translates in order to ...


1

The cheapest (but not necessarily very flexible) solution would be to duplicate the shader code in your C# script. When the player clicks, fire a ray through the mouse position. Capture the RaycastHit struct, and it will give you the world position and texture coordinates of the point directly under the mouse. (If you've displaced your sphere out along the ...


1

The screen coords go from {-1,-1} to {1,1} but you are most likely feeding it {0,0} to {1,1} - hence the fact that only one-quarter of the screen gets rendered. So just to be clear - point {0,0} is not the top-left (or bottom-left, depending on your co-ordinate system) point; it's the center. This also explains the texture coord tranformation that you are ...



Only top voted, non community-wiki answers of a minimum length are eligible