Tag Info

New answers tagged

4

Absolutely, But not as simple as taking a return value of a normal function. First I assume your question isn't about sharing variables between two shader stages (vertex, fragment..etc) but actually between two shader (programs). Shaders are part of the rendering pipeline, every input/output should pass through the rendering pipeline and its memory is ...


2

What you essentially want is the depth in camera coordinates, but relative to model, not camera. the easiest way to achieve that is to calculate the position of the origin of a model coordinate system in camera coordinates. ... vec4 cs_position = glModelViewMatrix * gl_Vertex; vec4 origin_position = glModelViewMatrix * vec4(0,0,0,1); distToOrigin = ...


1

calculate a bounding volume of the object (sphere, convex hull, box - depends on your speed/accuracy needs), this needs to be done only once - at initalization while rendering, for each object: transform camera (origin, direction) to object space project bounding volume on camera direction axis and subtract camera origin projection to retrieve min/max ...


1

The easiest thing would be to create a gradient in Photoshop/Paint.NET/GIMP/whatever you use and blend that with your tile(s). If you want a more procedural approach, then take a look at Color.Lerp. A gradient with that method is simple. The first color parameter is the light shade, the second is the final dark shade and the progress is the row/column of ...


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 ...


1

There is a way to force a game to use WARP without disabling Display Driver, Just install the direct X SDK. http://www.microsoft.com/en-us/download/details.aspx?id=6812 Go to C:/windows/system32 Run dxcpl.exe In "Scope" click "Edit list" Add The Path To Your Application Go to your game / application directory And Launch It.


2

Try doing this:- try { Robot bot = new Robot(); bot.keyPress(KeyEvent.VK_F6); bot.delay(50); bot.keyRelease(KeyEvent.VK_F6); } catch (AWTException ex) { Logger.getLogger(main.class.getName()).log(Level.SEVERE, null, ex); }


1

When using the standard Sample method, the automatic MIP level selection is actually quite complex. Assuming standard tri-linear sampling of a 2D texture, two MIP levels are actually sampled. The hardware determines which ones by looking at the texture coordinate arguments of four adjacent pixel shader invocations (referred to as a "quad"), and calculates ...


0

You can use SampleLevel to manually select the mip level. The 3rd parameter specifies the mip level. Documentation here.


0

The smallest single float supported by DirectX 11.x is DXGI_FORMAT_R16_FLOAT which requires Feature Level 10.0 or better hardware. The smallest single float supported by Feature Level 9.x is DXGI_FORMAT_R32_FLOAT. If you can require Feature Level 10.0+ or better hardware, a better choice might be to use DXGI_FORMAT_R11G11B10_FLOAT or ...


0

the way to create your Quaternion rotations matrices (I assume from euler angles) look funny, I would expect you use unit vectors of each axis rather than axis XMMATRIX rotateQX = XMMatrixRotationQuaternion(MathHelper::XMConvertToQuaternion(XMFLOAT3(1, 0, 0), radianRotation.x)); XMMATRIX rotateQY = ...


0

On this line: XMStoreFloat4x4(&mWorld, scaling*rotateQX*rotateQY*rotateQZ*translate); does changing the order to: XMStoreFloat4x4(&mWorld, translate*rotateQX*rotateQY*rotateQZ*scaling); make a difference? If you meant to rotate about the origin then translate outwards then you need to be careful with your ordering, though I'm making assumptions ...


2

I'd expect the conversion to be more like: static XMVECTOR XMConvertToQuaternion(XMFLOAT3 axis, float radian) { return XMVectorSet(sin(radian/2)*axis.x, sin(radian/2)*axis.y, sin(radian/2)*axis.z, cos(radian/2)); } in particular there is no need to push the coordinates through a cos and the w should be the last coordinate, there is a micro optimization ...


0

All versions of D3DX are deprecated and not included with the Windows 8.x SDK. This is covered on MSDN and on my blog. Ideally, you should change your program to not use D3DX. A full list of replacements for D3DX functionality can be found here. In summary: If you are on Direct3D 10, port to Direct3D 11. Then use the wide variety of Direct3D 11 support ...


1

Do I use XMMatrixRotationQuaternion(XMVECTOR quaternion) and multiply the resultant Matrix with my scaling matrix and translation matrix to get my transformation matrix? I believe so. At least that's what I do with D3D9. (D3DXMatrixRotationQuaternion) You might already know but multiplication order should be : scalingMatrix * rotationMatrix * ...


2

Depending on the texture, if you're changing the texture based on orthogonal connections, you'll only need 5 (if the texture can be rotated) or as many as 15. The simplest solution is to create these textures manually. You'll have a much easier time getting the visuals right. As for deciding which to use, see this question and answer: Choose tile based on ...


2

The D3DX 11 library has been discontinued so if you want to use it you will have to download the 2010 SDK and install it. (If paths are not already set up, you will have to set the library and include paths for your project to the folder where the SDK installs (somewhere in Program Files (x86) IIRC). However, if you want functionality similar to that of ...


0

Your rotation will clearly always be the same every frame. The code you wrote there just sets the rotation to one single value every frame, if this code is run every frame, that is. Instead, have a variable , say rotation_offset that will be updated each frame, and will have a scope outside this for loop you have there. You should do something like this: ` ...


3

This is my fault - the 0 values are caused by a bug in RenderDoc v0.20 - the x0[] indexable temp register being used there which contains your kernel data wasn't implemented in the shader debugging at the time of that release - I implemented it a few months ago. I'm hoping to get v0.21 with all the latest fixes out this week-ish.


1

In supplemental to Syntac_'s example, here's how you could also load some keyframe and skeletal animation data. For a start, given you have an Fbx scene object initialized, you could pass fbxScene->GetRootNode() to a method like this: void MyFbxScene::LoadNode(FbxNode* fbxNode) { int numAttributes = fbxNode->GetNodeAttributeCount(); for (int i = ...



Top 50 recent answers are included