• Advertisement
  • Popular Tags

  • Popular Now

  • Advertisement
  • Similar Content

    • By Michael Santer
      Hi!
      We're currently two programmers and a game designer working on a turn-based tactics fantasy board game. For reference you can search for images of "Tactics Arena Online", a fairly dated game that used to have a lot of depth and complexity.
      Our goal is to use the same combat concepts, but giving it a much needed modern touch as well as a whole new set of heroes to choose from with additional abilities. The game is a mix of isometric and 3D and we plan to release the game on Steam and hopefully Android & iOS as well.
      We are looking for someone to work with us pro-bono (just like we're doing) as a 3D character artist. The skills needed are creativity, a hard working attitude and an ability to make minor animations (things like idle, walk, block and very rudimentary attack animations). A perk to have would be the ability to make some VFX. If the game makes it on steam and money starts coming in, you'd obviously be compensated for your hard work, but as it stands this is a hobby project to garnish your portfolio.
      A bit more about the game:
      This game will be an online multiplayer game where each user gets to pick up to 10 characters to place on his half of the board (this would be done before even entering matchmaking. Think runes in League of Legends for example). The user can place his 10 units of choice anywhere he likes on his half board. Some units can be used more than once. So if you want 4 knights and 2 mages or even if you want 10 clerics, you can do as you please. You can then save your setups for future use. The goal of the game is to wipe out the enemy team.
      Each character or Hero (except premium and abyss characters) start with 1 ability and they can ascend (either by playing a certain amount of matches with the character or by forcing the ascension with real money) to gain a new ability or passive. Acquiring a new character can be done by using in-game currency that you earn from playing matches or using real money with the exception of Abyss characters which can only be acquired by winning certain rare matches. The goal is to offer a freemium game with lots of customizable elements while making sure that no user can "buy power" with real money. We want everything that a paying user can get to be available to non-paying users who play the game a lot.
      Ultimately we want this to become a competitive game that people can enjoy and really get invested in. Each character is designed with options for counterplay in mind and synergy with other heroes.
       
      We sincerely believe in what this game can become and we home to find someone just as passionate as we are to get involved in this project!
    • By Jens Eckervogt
      Hello guys, 
       
      Please tell me! 
      How do I know? Why does wavefront not show for me?
      I already checked I have non errors yet.
      using OpenTK; using System.Collections.Generic; using System.IO; using System.Text; namespace Tutorial_08.net.sourceskyboxer { public class WaveFrontLoader { private static List<Vector3> inPositions; private static List<Vector2> inTexcoords; private static List<Vector3> inNormals; private static List<float> positions; private static List<float> texcoords; private static List<int> indices; public static RawModel LoadObjModel(string filename, Loader loader) { inPositions = new List<Vector3>(); inTexcoords = new List<Vector2>(); inNormals = new List<Vector3>(); positions = new List<float>(); texcoords = new List<float>(); indices = new List<int>(); int nextIdx = 0; using (var reader = new StreamReader(File.Open("Contents/" + filename + ".obj", FileMode.Open), Encoding.UTF8)) { string line = reader.ReadLine(); int i = reader.Read(); while (true) { string[] currentLine = line.Split(); if (currentLine[0] == "v") { Vector3 pos = new Vector3(float.Parse(currentLine[1]), float.Parse(currentLine[2]), float.Parse(currentLine[3])); inPositions.Add(pos); if (currentLine[1] == "t") { Vector2 tex = new Vector2(float.Parse(currentLine[1]), float.Parse(currentLine[2])); inTexcoords.Add(tex); } if (currentLine[1] == "n") { Vector3 nom = new Vector3(float.Parse(currentLine[1]), float.Parse(currentLine[2]), float.Parse(currentLine[3])); inNormals.Add(nom); } } if (currentLine[0] == "f") { Vector3 pos = inPositions[0]; positions.Add(pos.X); positions.Add(pos.Y); positions.Add(pos.Z); Vector2 tc = inTexcoords[0]; texcoords.Add(tc.X); texcoords.Add(tc.Y); indices.Add(nextIdx); ++nextIdx; } reader.Close(); return loader.loadToVAO(positions.ToArray(), texcoords.ToArray(), indices.ToArray()); } } } } } And It have tried other method but it can't show for me.  I am mad now. Because any OpenTK developers won't help me.
      Please help me how do I fix.

      And my download (mega.nz) should it is original but I tried no success...
      - Add blend source and png file here I have tried tried,.....  
       
      PS: Why is our community not active? I wait very longer. Stop to lie me!
      Thanks !
    • By Swatchoos
       
       

       
      Hi Guys,
      We would like to present our new panel: Swatchoos, the most advanced swatch panel for Adobe Photoshop CC with lots of features and improvements like:
      - Group Creation and Management
      - Swatch and Group Reordering
      - Change brightness and darkness of any color
      - Sort Swatches by Luminosity or HUE
      - Fill any Shape/Text/Bitmap layer
      - Generate Swatches from bitmaps and .psd layers
      - Customisable the look of your color
      - Import .aco or bitmaps
      - Share your swatch palettes with others
      - Auto color naming
      and much much more.
       
      You can try it for free so go to www.swatchoos.com and test it out!
      SWATCHOOS_3dtotal_movie.mp4
    • By Paszq
      Troglodytes are a playable races in Arpago - they usually don't talk much and most of them lives near water sources.
  • Advertisement
  • Advertisement

DX11 D3D11 CubeMap GenerateMips only update one face.

Recommended Posts

Hello, I would like to generate mipmaps for a RGBA8 texture, however it only works for one face. Here my source:

 

D3D11_TEXTURE2D_DESC desc = { 0 };
	desc.Width = this->x;
	desc.Height = this->y;

	if(cil_props & CIL_CUBE_MAP)
		desc.ArraySize = 6;
	else
		desc.ArraySize = 1;

	if (this->props&TEXT_BASIC_FORMAT::CH_ALPHA)
		desc.Format = DXGI_FORMAT_R8_UNORM;
	else
		desc.Format = DXGI_FORMAT_R8G8B8A8_UNORM;

	desc.SampleDesc.Count = 1;
	desc.BindFlags = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_RENDER_TARGET;	
	
	desc.MiscFlags = 0;
	if (cil_props & CIL_CUBE_MAP) {
		desc.MiscFlags = D3D11_RESOURCE_MISC_TEXTURECUBE;		
	}
	desc.MipLevels = 0;
	desc.MiscFlags |= D3D11_RESOURCE_MISC_GENERATE_MIPS;

	HRESULT hr;
	hr = D3D11Device->CreateTexture2D(&desc, nullptr, Tex.GetAddressOf());

	if (hr != S_OK) {
		this->id = -1;
		return;
	}

	D3D11_SHADER_RESOURCE_VIEW_DESC srvDesc{};
	srvDesc.Format = desc.Format;
	if (cil_props & CIL_CUBE_MAP) {
		srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURECUBE;
		srvDesc.Texture2D.MipLevels = -1;
		srvDesc.TextureCube.MipLevels = -1;
	}
	else {
		srvDesc.ViewDimension = D3D11_SRV_DIMENSION_TEXTURE2D;
		srvDesc.Texture2D.MipLevels = -1;
	}


	D3D11Device->CreateShaderResourceView(Tex.Get(), &srvDesc, pSRVTex.GetAddressOf());

	D3D11_SUBRESOURCE_DATA initData[6];
	int bufferSize = this->size/6;
	if (cil_props & CIL_CUBE_MAP) {
		unsigned char *pHead = buffer;
		for (int i = 0; i < 6; i++) {
			initData.pSysMem = pHead;
			initData.SysMemPitch = sizeof(unsigned char) * this->x * 4;
			pHead += bufferSize;
		}
	}else {
		initData[0].pSysMem = buffer;
		initData[0].SysMemPitch = sizeof(unsigned char) * this->x * 4;
	}

	if (cil_props & CIL_CUBE_MAP) {
		for (int i = 0; i < 6; i++) {
			D3D11DeviceContext->UpdateSubresource(Tex.Get(), i, 0, initData.pSysMem, initData.SysMemPitch, size); //size is the size of the entire buffer
		}
	}else {
		D3D11DeviceContext->UpdateSubresource(Tex.Get(), 0, 0, buffer, initData[0].SysMemPitch, 0);
	}


	D3D11DeviceContext->GenerateMips(pSRVTex.Get());

 

This code assume RGBA (32 bpp) and no mipmaps in the buffer. This is how it looks without mipmaps:

 

nomip.thumb.png.81be870adaaa65262456cdfbc1842923.png

This is how it looks with the code above, only one face is updated but curiously, that face alone does have mipmaps:

mipbad.thumb.png.26f8890e23b2ddac162ec0b04e330c46.png

 

Can anyone help me, I can add mipmaps offline but this should work, I would like to handle were the buffer is a cubemap and doesn't have any mipmaps. I tried on Intel and Nvidia, so I guess is not a driver issue, but something I am doing wrong.

 

Thanks!

Edited by _Camus_

Share this post


Link to post
Share on other sites
Advertisement

You seem to be updating subresource 'i' here:

D3D11DeviceContext->UpdateSubresource(Tex.Get(), i, 0, initData[i].pSysMem, initData[i].SysMemPitch, size);

Whereas you should be updating subresource index D3D11CalcSubresource(mip, slice, numMips).

The 6 mips you want to update are not subresources 0,1,2,3,4,5, but rather (0 * numMips), (1 * numMips), (2 * numMips)... etc.

Edited by ajmiles

Share this post


Link to post
Share on other sites
2 hours ago, ajmiles said:

You seem to be updating subresource 'i' here:


D3D11DeviceContext->UpdateSubresource(Tex.Get(), i, 0, initData[i].pSysMem, initData[i].SysMemPitch, size);

Whereas you should be updating subresource index D3D11CalcSubresource(mip, slice, numMips).

The 6 mips you want to update are not subresources 0,1,2,3,4,5, but rather (0 * numMips), (1 * numMips), (2 * numMips)... etc.

 

Thank you so much! I was doing it wrong, changed to:

int MipMapCount = 1 + floor(log10((float)max(this->x, this->y)) / log10(2.0));
	if (cil_props & CIL_CUBE_MAP) {
		for (int i = 0; i < 6; i++) {
			for (int j = 0; j < MipMapCount; j++) {
				D3D11DeviceContext->UpdateSubresource(Tex.Get(), D3D11CalcSubresource(j, i, MipMapCount), 0, initData[0].pSysMem, initData[0].SysMemPitch, size);
			}
		}
	}else {
		D3D11DeviceContext->UpdateSubresource(Tex.Get(), 0, 0, buffer, initData[0].SysMemPitch, 0);
	}

And now it's working just fine! 

mipmap.thumb.png.69c106d0ee36b0147590f17eb49a98ee.png

 

Thank you once again!

Share this post


Link to post
Share on other sites

If you'd like to get rid of the iffy looking calculation for "MipMapCount", just call Tex->GetDesc() and the MipCount field will be populated with the actual mip count (rather than the 0 you filled it in with to create it).

Glad it's working!

Share this post


Link to post
Share on other sites

In fact it was wrong, I was sending the same face all the time and making it for all the mipmaps is not needed. I also followed your advice and used the desc to get the mipmap count! Thanks, this is the working code:

 

D3D11_TEXTURE2D_DESC pDesc;
	Tex->GetDesc(&pDesc);
	int MipMapCount = pDesc.MipLevels;
	if (cil_props & CIL_CUBE_MAP) {
		for (int i = 0; i < 6; i++) {
				D3D11DeviceContext->UpdateSubresource(Tex.Get(), D3D11CalcSubresource(0, i, MipMapCount), 0, initData.pSysMem, initData.SysMemPitch, 0);
		}
	}else {
		D3D11DeviceContext->UpdateSubresource(Tex.Get(), 0, 0, buffer, initData[0].SysMemPitch, 0);
	}

 

And the correct output:

Correct.thumb.png.5e2f3bf12b6ec1b9a797732d24f8ddad.png

 

Again, thanks for the time.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Advertisement