Tag Info

New answers tagged

0

You could look at projecting your texture (decal) onto a surface. Wolfire have a good blog post to get started on decal projection here.


0

As Namek says, one way is to bind the overlay texture and do the adding yourself in the pixel shader. Alternatively, re-render the geometry that contains the glyphs using additive blending and bind the overlay textures instead of the regular ones. Depth test should be enabled, depth writes should be off, and you would need to add a small depth bias to ...


2

Yes. There an article about this by Chris­t­ian Schüler: http://www.thetenthplanet.de/archives/1180 It's a followup to a book article (ShaderX 5) which did exactly what you need. I've used it myself. Here is the part that you need: (p : world-space position, N : world-space normal) mat3 cotangent_frame( vec3 N, vec3 p, vec2 uv ) { // get edge vectors ...


2

Your hunch is correct. There must be external information mapping regions of the image to sprites unless all the information the application needs can be derived from hardcoded knowledge and regularity. Even in your regular grid-based example, you lack some information for the general case. Common metadata for sprite sheets are: origin, a location inside ...


1

using a single vec4 uniform you can use arbitrary sized sprites: uniform vec4 spriteLoc;//x and y is the relative offset and z and w is the scaling factor varrying vec2 texCoord;//0-1 as you would without the atlas main(){ gl_fragColor = sampler2D(atlas, texCoord.xy*spriteLoc.zw + spriteLoc.xy); }


1

The DDS file format changed between dx9 and dx10. dx9 had been supporting a lot of new features via kludges, these new features were finally added as full types with the switch to DXGI. What this means is that most existing DDS viewers do not support any of the new texture formats or even files saved from directXtex. (The new semi-open source microsoft ...


0

Found the issue. You have to use tex2.Apply(); For the SetPixel() changes to take effect.


0

I'm not using DDSTextureLoader() functions myself, but it seems that the function creates appropriate shader resource view for you to match the DDS format and the associated sRGB space, thus you get about the same linearized result in the shader regardless if you use sRGB format in your DDS file or not. You could create your own SRV instead with fixed sRGB ...


2

SharpDX is a DirectX wrapper, not an XNA one. XNA's GetData methods are higher-level abstractions on top of the underlying DirectX functionality. If you're using the D3D9 interface, you probably want a variant of LockRectangle. If you're using D3D11 you probably want some variant of MapSubresource (or the similar method for D3D10). Note that in D3D9 the ...


1

Yes, this is a fine approach - it will be orders of magnitude faster than creating a primitive per data point. Assuming single-channel data, you should use whatever DXGI_FORMAT (or equivalent in OGL) maps to your source data, and convert in the pixel shader. There are native types for 8, 16, and 32-bit integers, as well as 32-bit floats. You should also ...


0

I would recommend using Sprite Textures. You will need to do the following: Set your texture type to Sprite (2D and UI). Set Sprite mode to Multiple. Access the Sprite editor and use the Slice tool (sneakily hidden in the upper left corner) From here, slice up the single image and get multiple sprites to your heart's content. Then you can use these ...


2

If you modify a material, it affects the objects that are using it. You need to duplicate that material, modify its texture and reassign it to the target object.


3

The only apparent error in your code is that you seem to specifying 4 mip-levels, from level 0 to level 3, however, you set GL_TEXTURE_MAX_LEVEL to 4. The max level is the zero-based index of the last mip-level, so in this case, it should be 3: glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 3);


0

Depends on what you do. For a 3D game you have to test it in practice - if it looks good when the camera is the closest - then the size is fine (you can even try to decrease the size of the texture to save memory/bandwidth). For a 2D game (orthographic camera) having textures in the same size (in pixels) as they appear on the screen might not be a bad idea ...


1

Use an opacity map! Simply trace the outline of the eye in Photoshop, and make the "visible" part of the texture white, and the part you want invisible black. Then inside 3DS Max, go to your texture's mapping channels and insert the black and white image into "Opacity Map"—and voila! No more silly whiteness. P.S. The reason the black space shows up as ...


0

I assume your noise is outputting height values for the terrain - the style shouldn't matter, as that's applied after the noise is done with. Add a lower octave of noise and add (or otherwise combine) them together. The lower the octave (larger amplitude and lower frequency) the larger/longer the features it creates, so to add hills you need to add that sort ...


3

I'm not finding any way to do this within the cocos2d framework, so if someone can do that it would probably be a better answer. However, cc.Texture2D does have a getHtmlElementObj() function. Now, this function can return either an image element or a canvas element. If it returns an image, you need to make a canvas from it as shown in this answer: var ...



Top 50 recent answers are included