Tag Info

New answers tagged

2

What you need is to retroproject the point on your map, from the inverse Mercator into 3d space, then place the sun as a directional light (not point like your image shows), and adjust the point for earth tilting (according to earth-sun rotation plane), then you can evaluate the light. It will automatically give you the weird valley shape that we see in ...


0

As suggested in the comments, the precision directives are not supported in the OpenGL version that haxe/lime compiles to. Adding a #version 130 doesn't work either, maybe haxe or lime doesn't read these I don't know. Anyway I found the solution reading through the lime samples: #if !desktop "precision mediump float;" + #end "varying vec4 v_color; void ...


0

I came up with a simplistic solution to this a few years ago in a non-realtime context (mesh slicing for 3d printing). Given a plane defined in world coordinates by a point (origin) and a vector (normal). First setup a matrix that transforms your mesh into the coordinate system of the plane. Now do a z-bounds check of all the edges of the mesh (i.e. ...


0

Thank you a lot, the solution with tex2Dgrad work perfectly ! I don't have tested the solution with texldb, because there use registers and I want to avoid that.


0

Shader Model 2.0 has no such function, but "tex2Dgrad" can be used to the same effect if your shader has access to the dimensions of the texture. (Note that tex2Dgrad availability is subject to the caps bit D3DD3DPSHADERCAPS2_0_GRADIENTINSTRUCTIONS, so this isn't a sure thing) Instead of: color = tex2Dlod(map, uv, lod); Do: float scale = ...


1

Look at the pixel shader instructions in Shader Model 2. I found "texldb" : Biased texture load instruction. This instruction uses the fourth element (.a or .w) to bias the texture-sampling level-of-detail just before sampling Syntax texldb dst, src0, src1 https://msdn.microsoft.com/en-us/library/windows/desktop/bb206217(v=vs.85).aspx


1

D3D9 doesn't support constant buffers but all uniforms are placed into one global "constant buffer". You can set multiple float4 constants at once with IDirect3DDevice9::SetPixelShaderConstantF() by passing the number of constants as the last argument.


0

I tested your script and was able to dynamically adjust the colors of the line renderer. Perhaps you didn't pass your linerenderer component into your script in the editor on the attached object? Alternatively, you could add to your script: void Start() { lineRenderer = gameObject.GetComponent<LineRenderer>(); } Aside from that your code seems ...


0

Like you say, the obvious one is 3d vs 2d. It really depends on what kind of 2d and 3d shaders you are doing but in general 3d shaders will have more complex math and more advanced techniques. You likely won't be reading and writing from the depth buffer in 2d shaders and won't probably be doing multiple renders per frame to do things like shadow maps, ...


0

Turns out, the png file doesn't have any background (I expected there to be a white background behind the flag image). This is how Unity handles textures when the texture file (PNG) doesn't have a background. Get a white background in the texture file and you're good to go.


4

You can get this behaviour without a branch using the step function: float blendFactor = step(3.0f, dot(B.rgb, B.rgb)); return lerp(B, A, blendFactor); When B = (1, 1, 1), dot(B, B) = 3.0f, so step returns 1, blendFactor = 1, and the lerp gives a result of A. When B is anything less, dot(B, B) < 3.0f, so step returns 0, blendFactor drops to 0, and the ...



Top 50 recent answers are included