Jump to content

  • Log In with Google      Sign In   
  • Create Account


thedodgeruk

Member Since 30 Jun 2010
Offline Last Active May 14 2013 11:06 AM
*****

#4876958 what the maximum size of an array allowed?

Posted by thedodgeruk on 25 October 2011 - 04:54 PM

i know if you do

int[] = new int[100000] ;
thtats ok , but takes a lot of time to create these



i wish to just use

int[20000] , but its some were between 15000 and 20000 it give an error, is there a way to increase this amount to at least 50,000


#4875002 whats the fastest way to bucket sort pointers?

Posted by thedodgeruk on 21 October 2011 - 05:06 AM



And

std::map<shader*, std::vector<model*>>
(using smart pointers where appropriate) is insufficient?

Is it too slow to populate, to iterate over, to search through?


tred that , was way too slow .

had to re configure my engine to use enums : got the speed now though


enums aren't any smaller or easier to hash than pointers. If you're not using pointers and are copying your entire object every time... yeah, that's going to suck.

But since you won't actually tell us anything meaningful... best of luck with that.



erm , need to sort my entitys so that i have less state changes on the GPU , so need to bucket sort all my enttiys via the shader pointer , so when done i have one bucket for all entitys that have shader plaincolour, other plainTexture , other phong , other normalmapping ect

and did an analize and it was saying with map, it was saying the slowest thing in my engine was itterating through the map , once i collected all my info into the buckets





#4874859 Assimp Textures

Posted by thedodgeruk on 20 October 2011 - 05:58 PM

would someone mind explaining a little on how Assimp handles textures. I've started working on a model loader and can currently load models. I'm using a simple color shader right now until I can figure out textures to display the model. I can get the uv coords for the textures and add them to my vertex structure.. but that's about all I understand how to do as far as how assimp handles textures.


assimp does not use textures , the shader does


#4874858 whats the fastest way to bucket sort pointers?

Posted by thedodgeruk on 20 October 2011 - 05:57 PM

And

std::map<shader*, std::vector<model*>>
(using smart pointers where appropriate) is insufficient?

Is it too slow to populate, to iterate over, to search through?


tred that , was way too slow .

had to re configure my engine to use enums : got the speed now though


#4874784 whats the fastest way to bucket sort pointers?

Posted by thedodgeruk on 20 October 2011 - 12:51 PM

i have shaders only 12 of them so far , they will be increasing and entitys,

every entity has a pointer to a shader

i want to bucket each entity into groups of shaders.

i used stl::maps but this seams slow , is there a faster way ?




i ahve entitys , ie. models , and they all have shader pointers . this is so that they have a ppointer to the differnt shaders

i want to sort all the models into seperate vectors, for fast access. they need to be sorted vai the pointers of the shaders.




#4874766 whats the fastest way to bucket sort pointers?

Posted by thedodgeruk on 20 October 2011 - 11:46 AM

i have shaders only 12 of them so far , they will be increasing and entitys,

every entity has a pointer to a shader

i want to bucket each entity into groups of shaders.

i used stl::maps but this seams slow , is there a faster way ?



#4874066 how do i load ID3D10ShaderResourceView* into texture2darray

Posted by thedodgeruk on 18 October 2011 - 04:36 PM

You need to create the associated Texture2D resource as a Texture2D array resource, and then create a shader resource view for that resource. If you're using D3DX helper functions the easiest thing to do is this:

1. Load all of the textures using D3DX10CreateTextureFromFile, with a D3DX10_IMAGE_LOAD_INFO specifying that you want D3D10_USAGE_STAGING. Note that all of your textures need to be the same size, have the same format, and have the same number of mip levels
2. Map every mip level of every texture
3. Set up an array of D3D10_SUBRESOURCE_DATA's with number of elements == number of textures * number of mip levels.
4. For each texture, set the pSysMem member of a D3D10_SUBRESOURCE_DATA to the pointer you got when you mapped each mip level of each texture. Make sure you also set the SysMemPitch to the pitch you got when you mapped that mip level
5. Call CreateTexture2D with the desired array size, and pass the array of D3D10_SUBRESOURCE_DATA's
6. Create a shader resource view for the texture



all my files are loaded in as ID3D10ShaderResourceView


is there no way to make is use this to create another ID3D10ShaderResourceView which is an array?




#4874063 how do i load ID3D10ShaderResourceView* into texture2darray

Posted by thedodgeruk on 18 October 2011 - 04:12 PM

i can send over ID3D10ShaderResourceView files to texture2d in the shader

but i need to send over an array of them to texture2dArray in the shader


i can send them over to a texture2d[100]; but this will not allow me to do the thing i want


#4872933 Noob C++ Question

Posted by thedodgeruk on 15 October 2011 - 01:07 PM

Good evening to all at GameDev im very much a noob to C++ and i am looking for some advice to my issue
below is the source to a small program where i get the user to enter there name and then there name is displayed back to them on the screen all this works 100% fine but the main issue is that the console window closes and opens very fast below is the source code

#include <iostream>
#include <string> 

int main()
{ 
	std::string FirstName;  

	std::cout << "Please enter your first name:";
	std::cin >> FirstName;
	std::cout << FirstName << "\n";   
	std::cin.get();

	return 0;

}

Thank you very much in advance


add the line system("pause"); before return;





#4811697 Proper Shader Algorith For Standard Lighting Effect

Posted by thedodgeruk on 16 May 2011 - 05:49 PM

you need to move to proper HLSL now , not the old methid

Hi,

I've got a load of source compiled and running with the from source engine I'm learning. Quite a big step for me all those static libraries, dynamincally linked libraries, a tonne of SIMD stuff that had to be commented out because it was in the wrong assembly format for my compiler (Intel whereas CB uses AT&T), pixel shader, vertex shaders etc....

Sure I've come a long way. Shoot I even know how most of it works. I printed off a load of paper copies of the source and I often nip out to local pubs for a coffee whilst having a read!

But I have hit a couple of snags in concept stuff. Mainly about what's really going on between the CPU, the RAM and the GPU and the RAM on the graphics card (not sure of proper terminology for this). That's for another thread though, this one is about shaders and lighting.

I've got the shaders to run and work. Have a look at their code, pretty simple as far as I know in shader talk:

Vertex Shader(vsh):
vs.1.1
dcl_position0 v0
dcl_normal0   v3
dcl_texcoord0 v6
m4x4 oPos, v0, c0
mov oD0, c4
mov oT0, v6

The vsh does some stuff with the geometry and then moves the value stored in the constant register c4 into the output register oD0 which is then inputted into the psh. Whenever a function that affects the light is used it gets the value relating to light colour and intensity and loads it into the register c4. SetAmbientLight does this, for example.

Pixel Shader:(psh)
ps.1.1
tex t0
mul r0, v0, t0

Here the value in v0 (which I assume is the received light data from the vsh) is multiplied with the texel and the final result stored in the psh output register r0. Ok fine.

BUT (you knew it was coming).....

The scene is blacker than the underside of a witch's boob on a moonless night. If I change the code for the psh to this:

Pixel Shader:(psh)
ps.1.1
tex t0
add r0, v0, t0

... then all affected geometry becomes so bright you could hunt rabbits with them on a dark winter's evening.

So, obviously something odd is happening here. The original author's shaders produces scenes that are way too dark. Yet my own alterations produce scenes that are horribly bright, and cause very bad colour mixing between the ambient light and the texel colour. Like if for example I set ambient to 0.5f,0.5f,0.5f middle of teh road grey, then instead of the predominatly green appearance of the demo model (a green tank) showing through more strongly, it just has this awful painted grey appearance to it, rather like someone has just thrown a load of grey paint over it.

So:

What is the proper method here? I just want to be able to nicely mimic with a shader what i've already achieved fine with the fixed function pipeline in the past. But I don't know the proper algorithm for lighting. The one I've made is bright but awful, the one the author made is horribly dark, even with ambient light set to max (1.0f,1.0f,1.0f).

I'd also rather not discuss point and directional lights just yet, although I have got these working well, but again I had to depart from the author's code as it was too dark. Furthermore the extra passes per light make things difficult so if possible I'd rather just talk about getting good ambient light working for now, thanks.

I'd appreciate any replies anyone can take the time to write. Seems to me good lighting it what makes a huge difference to the pleasure the eye feels when playing a game or looking at any rendered scene for that matter.

Anway, thanks :)




PARTNERS