• Content count

  • Joined

  • Last visited

Community Reputation

8338 Excellent

About unbird

  • Rank

Personal Information

  • Interests
  1. We don't, but here it's set so deliberately to use bilinear filtering for downsampling. Aside: You can use the API to do this, though you won't have control of the filtering: ID3D11DeviceContext::GenerateMips (note the mandatory creation flags for the texture) .
  2. Indeed, this particular effect could be very hard to model. You could get away with something similar/cheaper though. E.g. playing with analytic waves and sampling multiple times, or using mipmaps https://www.shadertoy.com/view/MtfyDN
  3. I wonder if that was made procedurally or even particles. Could be "simple" polar texture mapping, animate the tex coord, use a wrapping/tiling texture and blend ... somehow. To really know, we'd need the source of that game. You should tell what you got at your disposal (language, graphics API or engine), since if you want to go procedural you'd need pixel shader access or something, as irreversible shows. As for procedural: It can be as complex as you want. I recommend a look at shadertoy. Here some examples which I think do something you're after or at least serve as a starting point. Eclipse1 Eclipse2 (PS: I searched shadertoy with the key words plasma, halo, radial, circular and polar. Visually though the best results came back with "eclipse" ) Edit: Here a bare example of what I had in mind above: PolarMappingAnimation . Should have mentioned earler: shadertoy needs WebGL to work. Sorry.
  4. This is old reference emulating FFP with shaders. Can't find a direct download for the source though, it's probably lost http://www2.ati.com/misc/samples/dx9/FixedFuncShader.pdf Also from a quick glance this looks wrong: ambientEffect = normalize( ambientEffect ); Don't normalize. Doesn't make sense for a color factor. Edit: Found that thing among my stuff. Here you are: FFP.fx
  5. If you want to roll your own, read Buckeye's excellent article : Blending Animation Controller
  6. Genus Calculation again.

    You're confusing vertices with positions. A cube can't be sensibly represented with 8 vertices alone - if you need texcoords and/or normals, that is.
  7. WARP uses CPU so floats should behave IEEE compliant. Don't rely on this for GPU. At least assume they can behave differently. Probably the debugger emulates the instructions on CPU, too. You can check for NaNs in HLSL though: if(isnan(whatever)) return float4(1.0, 0.0, 0.0, 1.0); // Red alert, this is not a drill Final note: Instrumenting your HLSL code can of course rearrange the instructions and give different results. And then hide the bug
  8. WARP working and hardware not can indeed be an indication for a driver error. But a dot ? I also bet the compiler will issue a dot instruction even you handwrite it That debug view is suspicious but I for one wouldn't trust it. I never had much luck with shader debugging particularly because of such behaviour. But since you got output, color debugging it is. Dump the dot result directly afterwards, "wrapped lighting" style: return float4(diffuseFactor.xxx * 0.5 + 0.5, 1.0); I rather suspect NaNs coming from those pows or something. Check the shader compiler log, they might spit out warnings.
  9. System memory copy of vertices/mesh

    Also: The AABB of translated vertices is just the translated AABB.
  10. uint -> Format.R32_UInt ushort -> Format.R16_UInt Edit : Note that even after the edit you still use signed integers. Won't matter here though
  11. DX11 The native side of Hololens

    He meant not to use the 'Formatted' font (it's for code anyway), e.g. like so fixed.
  12. Floats are fine. This is a common problem with standard displays which only have 8 bits precision per channel (sometimes even less). You need to dither. This is a good presentation about: Banding in Games Also search these forums, the topic returns regularily.
  13. Good news: The editor has improved a bit I guess. But now I miss the BB-code mode, since I usually edit posts in Notepad++. Is it really gone ? For programming posts, I like to use a monospace font to designate code within normal text. This was originally possible with the [tt] tag. Like here. Hodgman also uses/used it a lot. I tried to use "Formatted" from the font selection, but as you can see, it changes the whole paragraph. I currently use italic as a workaround. Also, this post, changed the word "target" with links to some online store. Admins can check the history, not sure if it sill "works". (I then changed "render target" to "rendertarget" ) This is very annoying. I don't mind ads anywhere (e.g. between thread posts), but automatically changing text of mine gives the impression I put those links in. I did not. What is this ? Thanks PS: Also: Old emojis are corrupt.
  14. Yeah, that doesn't really work. Keep your shader as is. The problem is likely elsewhere. The log you show only demonstrates your intention, not necessarily the result. I guess you have a (temporary) read write hazard, which the pipeline forbids and resets. Since one is called backFaceTexture I expect it was a rendertarget at some point. Reset the rendertarget (output merger stage) to null before setting the SRV. To make sure: turn up the DX debug layer (which immediately reports such things) and/or dig deeper, e.g. with renderdoc and check if the SRV slots are actually set. Edit: Be warned about that Rastertek article, it's misleading. He confuses texture arrays with, well, arrays of textures. A texture array is one resource (and then one SRV / slot) with several slices similar to a 3D texture. In HLSL this is explicitly written as Texture2DArray . On the other hand Texture2D blah[2] will generate two slots.
  15. My new love : ShaderToy

    (since shadertoy doesn't allow more than a couple of lines in the description and I don't want to put all the stuff into the comment section there, I abuse the blog here) For everybody new - or not so new - to shaders, hear this: Browse and use ShaderToy ! Not only is it just bloody amazing what you find there, it's veeeeeery educational. And easy to use. No hassle with setting up the GPU pipeline yourself - you only need a WebGL capable browser (most are). The interactive compiler displays errors right after the faulty code lines. Minor nuisance for me was the sometimes "restrictive" behaviour of GLSL (coming from HLSL), but that's not deal breaking. After experimenting with signed distance functions in 3D with my SlimDX/HLSL stuff I was curious about 2D. So I found this (thank you Marteen): https://www.shadertoy.com/view/4dfXDn Very nice. Basic shapes with contours and the usual combiners. Improved with lighting and shadows. Expanding on this, experimenting with polygons and stars, I wanted to put it to the test with something less abstract. Anybody remember Spirograph ? The math around this (pun intended) is already endless. I didn't even know about roulettes before. But let's start simple. There's a very old discovery from a Persian astronomer: Tusi-Couple. Here a short protocol of the progress: Needed individual colouring for the shapes (Marteen's sample combines all shapes to one SDF). Experimenting with arbitrary blending, too (blend function). Animate the inner circle/wheel within the the outer. Just basic trigonometry. To make it more clear I colored both circles "Wheel of Fortune"-style (see radial function). Choose some point on the inner wheel, mark it with a point. I chose a star shape for this. Track the ellipse path. Since I got no clue how to derive that yet, I simply trial-and-errored. Only got a filled ellipse (or rather: used a transformed circle). Found a real ellipse and used that to generate an outline (ellipse and ellipseLine functions) The ellipse line produced some artifacts at the main axis. Needed some tweaking. Still not perfect, goes havoc in the degenerate case. Now use lineDist in that case. Hmmmm, cogs would be nice. Splitting the polygon function into circleMod (to get normalized angle part) and using polyShape for laying cyclic functions around a circle. The current implementation using a simple sinus is actually NOT a clean SDF. It works well enough though - and I expect a correct implementation to be quite challenging. Added spokes and bars to give even more of a mechanical/gear feeling. Steampunk rules. Challenge: Derive ellipse path automatically. I feared the worst. Ellipses are usually a bitch - algebraically. But in this case I found that one can exploit the simplicity of the Tusi-couple and derive the major/minor axis directly (see final if-clause within sceneDist function. Not yet commented) Add some light and make the thing scale with the viewport correctly (shadertoy has fullscreen capability). TODO: Choose 2nd point with mouse. This should be possible with additional input/buffer logic of the shadertoy setup. Haven't dug into it just yet. For now one can change the point at the start of the shader code, though (relativePos constant). ENJOY! If you're interested in SDFs I recommend this as a starting point: Distance functions. Quílez has more to offer, of course. He is also quite active on shadertoy. Rewriting classic games for instance. Wow. PS: Oh my, there are even sound shaders : https://www.shadertoy.com/view/MtGSWc