Hot answers tagged

13

I have been able to do this using the 3d modeling software Blender. I used UV mapping to map the texture and the displacement modifier to apply the height map. If you need some form of XNA code for this, I cannot supply it. Here it is as a 3d terrain. Surprisingly, it worked best on a uniformly square mesh. The steps required to create the terrain like i ...


8

since you admittedly don't have much experience with 3D and (presumably) OpenGL, I'll give you a "bird's eye" overview of the process. I'll do my considerations about OpenGL, but the basic reasoning yields for other APIs too. When you render something with a modern version of OpenGL you create objects that will reside into the GPU memory, and then mostly ...


6

A basic height map can be produced as follows: Generate a set of vertices that form a grid made of triangles in a regular pattern like A -- B -- C -- ... | \ | / | \ | \ | / | \ D -- E -- F -- ... | / | \ | / | / | \ | / ... ... ... Each of A, B, C, et cetera represents a vertex in the grid. It also represents a point on the height; ...


4

You shouldn't really worry about cutting of the other half of the sphere since Unity doesn't render faces that are looking away anyway. That doesn't solve your problem however. Try to save your sphere as a .blend file. Or if you did that, export it as an .fbx. If you really want to save resources you should bake(bake texture) your full sphere unto a ...


4

Release does not return an HRESULT, it returns a ULONG. That ULONG is the new reference count on the object (after the release). hr == S_FALSE in your code because Release is returning 1 (which is what S_FALSE is defined as), which means there's one pending reference count to the object after you release it (that's not necessarily a problem, it could be an ...


3

You are checking how many bytes there are per pixel, but you are not checking how colours are ordered, and it could be RGBA or BGRA (or possibly something else). You need something like this instead of mode = GL_RGBA (little-endian machines): if (surface->format->Rmask == 0x000000ff) mode = GL_RGBA; else mode = GL_BGRA; If you want a more ...


3

Yes, you can use that code to update a Unity RenderTexture (not simply a Texture2D). You need to make sure that code executes on the render thread. To do that, make sure you only call it in response to the GL.IssuePluginEvent (which will translate to the C++ function UnityRenderEvent).


3

1. Creating textured model in Blender First, add a new texture by going to texture panel on the right. Select type "Image or Movie", click "Open" and locate your texture file. Then, move your mouse to the 3d view, press Tab to select the default cube, then press "U" and select Unwrap. Go to UV Image Editor: and select the texture: At this point, the ...


3

Terrain has a "setAlphaMaps" function you can use to modify the terrain splat maps at runtime. You can find the documentation (along with an example) in the official unity documentation here: http://docs.unity3d.com/ScriptReference/TerrainData.SetAlphamaps.html Just make sure you call Terrain.Flush when you're done. As your target is a vector3 you will ...


3

I'm going to take a stab at answering this, though YMMV. I use the Steam Hardware Survey ( http://store.steampowered.com/hwsurvey?platform=pc ) to determine what is the video RAM (VRAM) available on most computers. Looking at the results as of 2015-10-13 (today), nearly 85% of people have 1024 MB VRAM. Your question is very broad, since it doesn't state ...


3

To get rid of the jagged lines add 1 line of transparent pixels around the rectangle texture. The issue with the dark lines is that you are most likely using black transparent pixels (color #000000). The issue is most likely to be gone if you use colored transparency instead. - Repeating the border pixels of your sprite - but simply with alpha=0


3

As /u/slime73 pointed out, you are missing , after your T coordinates. float vertices[] = {// X Y R G B S T -0.5f, +0.5f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f // Top-left +0.5f, +0.5f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f // Top-right +0.5f, -0.5f, 0.0f, 0.0f, 1.0f, 1.0f, 1.0f // ...


3

This depends on the details of your rendering setup, but here are the most common out-of-the-box behaviours: 1. Painter's Algorithm Many 2D frameworks simply layer sprites in the order they are drawn (so you need to draw your background before your foreground). In this case, whichever sprite occurs later in your drawing (ie. drawn from a later command, or ...


3

The texture regions inside don't need to be powers of two. But texture compression cells are often 4x4 so you have to be careful when using compressed textures that the edges of two texture regions don't share the same cell or they'll be compressed together which will degrade the quality if they have different colors. You should leave a N pixel border ...


3

The sourceRect is much better for this. Watch this if like a funny video explaining why: https://www.codeandweb.com/what-is-a-sprite-sheet-performance The more technical explanation: I am using pseudo code - the exact number of commands required might vary - but you should see what I am talking about. If you use isolated sprites the game engine has to ...


3

It looks like the issue is that you are doing non uniform scaling (different scale on x and y axis) and using nearest neighbour texture sampling. If you switch to using uniform scaling and/or bilinear texture sampling (or better, like bicubic) the problem should go away.


2

I know this is a couple years late but maybe someone searching for a solution will come across this. So in order to change the "Default" file type assigned to new Output Elements created in Render to Texture, you can do the following. 1 MaxScript > Open Script 2 Navigate to the MacroScripts folder in you installation directory 3 Open "Macro_BakeTextures....


2

I don't think it's possible to specify a source pitch for the buffer in CPU memory like you could with a lower level API. However, you can specify an offset into your pixels using a DataView, so you could upload a 1000x100 portion of the texture that way.


2

Try turning off backface culling. In your shader, put "Cull Off" in the "SubShader" section.


2

A tough one. Let's try. Let noise be your (infinite) noise function. Let Seam_noise be a seamless noise function in the dimension of your tiles. (here is an example , you can download c# code with a seamless perlin noise implementation ) Follow an example of seamless perlin repeated 4X4 times (the red quad is your tile dimension) Consider a "filter" ...


2

This deserves a very broad answer because texturing is historically THE one big job of graphics renderers. Put shortly, this happens during rasterization. Rasterization is a process in the rendering pipeline, where the graphic card generates pixels (fragments) from geometry and then passes it on to the next stage of the pipeline, the pixel (fragment) shader,...


2

Ok, so I tried executing these 2 pieces of code: (camera is camera=new OrthographicCamera(); camera.setToOrtho(true, 100, 100*screenW/screenH);, and the 2 texture regions are of size 64*64, from the same textureAtlas) Code 1: rendering on-screen public void renderGameScreen(){ spriteBatch.setProjectionMatrix(camera.combined); spriteBatch.begin(); ...


2

Explicitly enabling texture samplers is not necessary if you're drawing using the programmable shader pipeline (since whether or not you're sampling from textures, and what type of sampling to do across those textures is explicit in the shader code that you're using) However, based upon your code sample you appear to be rendering using the fixed function ...


2

What are the texture coordinates that you're using for those vertices? With D3DTADDRESS_CLAMP, they must be in the [0;1] range, anything else will be clamped to [0;1]. So, for example, using the [-1;0] coordinate range could cause this as it would make all of them effectively 0.


2

Firstly, why aren't you using GL_COMPRESSED_RGB_ARB for your textures which don't have an alpha channel? I'm not that familiar with OpenGL, but I think that should reduce their size in memory significantly. By default on Windows 32-bit applications only get 2GB of address space. You can improve that so that when run on a 64-bit operating system they get 4GB ...


2

You shouldn't call dispose directly on a Texture loaded by an AssetManager, they are disposed the the AssetManager is cleared or disposed or if you call unload on the AssetManager and pass the Texture. The reason you shouldn't dispose assets from an AssetManager is that they can be shared between many other assets (two fonts may use the same texture for ...


2

As suggested in the comments, you should try to use Tri-Linear filtering and MipMaps. The reason using TextureFilter.MipMapLinearLinear results in a black box is that you haven't generated the texture with MipMaps. In order to do so, simply pass a second parameter to the Texture constructor as true like so: img = new Texture("circle.png", true);


2

Expanded post on comment:"JSON is just a means of storing text information right? Why not just hold a path to the sprite in the JSON file? Then whenever you obtain the information in the JSON file, call Resources.Load (jsonPath); ?" The JSON language cannot directly load Sprites into Unity3D. However, as JSON can deal with strings, we can quite easily hold ...


2

I know it's stupid to answer my own question but... With very, very big thanks to @Ben I fixed this problem by creating SDL_Surface and load image to it once for each TextureAsset and store it inside TextureAsset instead of creating new SDL_Surface for same texture and free it each draw call.


2

I FINALLY FIXED IT Being a scrub to the Maya Hyper-shade panel. I did a load of research and found out it was due to my file type of the texture; I used a PNG and it caused the model to conflict with it's alpha opacity causing it to, well, be translucent. Thank you for all the feedback and I hope this solves anyone else's problems in Maya. All opaque <...



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