Jump to content

  • Log In with Google      Sign In   
  • Create Account

Dave

Member Since 22 Mar 2004
Offline Last Active Yesterday, 08:27 AM

#5295209 when do you load new shaders?

Posted by Dave on 06 June 2016 - 01:04 AM

Yep thats basically it.

 

The cost of switching shaders like this is generally non-free so be wary of doing thousands of shader switches per frame. It's best to batch them, for example.




#5293167 How to implement Cascaded Shadow Map technique ( simply )?

Posted by Dave on 24 May 2016 - 02:35 AM

Have you implemented basic shadow mapping yet?




#5291090 A Brain Dump of What I Worked on for Uncharted 4

Posted by Dave on 11 May 2016 - 03:18 AM

That's very cool, cheers for sharing. Are you allowed to share information on the tech used? I'm curious to know about what language(s) and framework(s) were used for the level editor and so on.




#5290074 Considering two methods of lighting

Posted by Dave on 04 May 2016 - 09:34 AM

I'd suggest looking up "Shadow Mapping" first, it's a basic approach that gives rough results but is a great starting point for learning about it.




#5290036 The best way to render text in D3D12

Posted by Dave on 04 May 2016 - 02:37 AM

In my immediate mode GUI I achieve some pretty nice font rendering, dynamic geometry for the whole UI is created each frame:

 

chessboard.png

 

I create quad lists for the text and update a vertex and index buffer each frame. I originally looked at using distance field fonts but i found it hard to achieve the same quality of rendering. The bitmap font sheet was rendered with the Angel Code bitmap font tool. I've added in some GUI elements that use the different font effects such as italic and drop shadow.




#5283363 In Game Console window using DirectX 11

Posted by Dave on 25 March 2016 - 06:38 AM

Thanks for the links ocornut, it's interesting to see what people have done with IMGUI.


#5283095 In Game Console window using DirectX 11

Posted by Dave on 24 March 2016 - 03:54 AM

The quickest solution would be IMGUI as suggested. I was never convinced it looked that great though and had limited skinning possibilities. I could be wrong though. If my understanding is correct and you wanted to ship the console with your game, it might be better to roll your own.




#5279977 How do you go about a Property System for an Editor?

Posted by Dave on 07 March 2016 - 02:56 AM

My editor is built in the engine so I just have:

void Scn_TransformComponent::GetProperties(Cor_PropertyCollection& collection)
{
	collection.PushGroup("Transform");
	collection.AddBool("Enabled", Cor_PropertyBool::GetDelegate(this, &Scn_TransformComponent::GetEnabled), Cor_PropertyBool::SetDelegate(this, &Scn_TransformComponent::SetEnabled));
	collection.AddVector3("Trans.", Cor_PropertyVector3::GetDelegate(this, &Scn_TransformComponent::GetTranslation), Cor_PropertyVector3::SetDelegate(this, &Scn_TransformComponent::SetTranslation));
	collection.AddVector3("Rot.",	Cor_PropertyVector3::GetDelegate(this, &Scn_TransformComponent::GetRotation), Cor_PropertyVector3::SetDelegate(this, &Scn_TransformComponent::SetRotation), Cor_PropertyAttributes("Degrees"));
	collection.AddVector3("Scal.",	Cor_PropertyVector3::GetDelegate(this, &Scn_TransformComponent::GetScaling), Cor_PropertyVector3::SetDelegate(this, &Scn_TransformComponent::SetScaling));
	
	collection.AddBool("Uniform Scale", Cor_PropertyBool::GetDelegate(this, &Scn_TransformComponent::GetUniformScreenScale), Cor_PropertyBool::SetDelegate(this, &Scn_TransformComponent::SetUniformScreenScale));
	if (m_params.m_uniformScreenScale)
	{
		collection.AddFloat32("Scale Fac.", Cor_PropertyFloat32::GetDelegate(this, &Scn_TransformComponent::GetUniformScaleFactor), Cor_PropertyFloat32::SetDelegate(this, &Scn_TransformComponent::SetUniformScaleFactor));
	}
	collection.PopGroup();
}



It's great because it's immediate, I don't have to convey the information about what properties I want in the property control using attributes (as in the style of C#) because I just do or don't give them in the GetProperties() method. I also don't have complicated macros because I just don't need a reflection system.




#5277855 Integrating Bullet into an entity-component system

Posted by Dave on 24 February 2016 - 04:17 AM

Are you actually making a game or a demo that requires these non-trivial entity hierarchies and multiple components of the same type? I integrated bullet into my entity-component system the most simple way which was one rigid body component per entity and one collision shape per component and i've yet to require anything else. Point being, just do what you need to do. There shouldn't really be any of these what-if scenarios until you actually need them and then the become scenarios and not what-ifs.




#5277277 Correct way of doing Mouse Picking

Posted by Dave on 21 February 2016 - 06:55 AM

You might also consider using a pick buffer which is a render target where each pixel contains an ID that is the object that covers that pixel. Therefore sampling the pick buffer under the cursor gives you the object the mouse is over. This doesn't solve box selection though, but is a simple way of doing it that doesnt involve alot of projection/unprojection. Note also that its particularly good for picking terrain, where typically you don't want to be doing ray triangle intersection.




#5265449 entity system implementation

Posted by Dave on 08 December 2015 - 10:11 AM

A reasonable compromise is to store a set of 1-bit flags on each entity, which tells you which components are attached to this entity. If you need to retrieve the component you'll still need to search for it in the relevant component array, but at least testing for it's presence is now cheap.

Sure that would work. I can't think of any occurrences where i've wanted to see if it has a specific component without actually wanting to do something with it though, not personally.

 

EDIT: I just did a quick google search and found this article again http://bitsquid.blogspot.co.uk/2014/09/building-data-oriented-entity-system.html. Under the heading 'accessing data' it talks about having a much smaller table of indices that provide an indirection to the components at their respective indices. So it looks like you'd use:

 

MAX_ENTITIES * sizeof(int) * MAX_COMPONENT_TYPES bytes for the indirection table and then a trimmed down component table.

rather than:

MAX_ENTITIES * MAX_COMPONENT_TYPES * AVERAGE_COMPONENT_SIZE and no indirection table (as I currently have).

 

So you'd save a tonne of memory that way.




#5265397 entity system implementation

Posted by Dave on 08 December 2015 - 12:43 AM

Sure, I declared that issue up front. I'm yet to find a balance between minimal memory consumption and 'very fast' lookup of components that doesnt involve storing the components on the entity.




#5265335 entity system implementation

Posted by Dave on 07 December 2015 - 03:22 PM

Have you tried the MAX_ENTITIES before BeerNutts, i'm curious what harm comes of it in your experience?




#5265302 entity system implementation

Posted by Dave on 07 December 2015 - 12:24 PM

I had the same problem.

 

I decided to take the memory hit and set a MAX_ENTITIES that my engine can support and block out arrays for MAX_ENTITIES for each component. This way each entity is basically a column in the table and doing checks for "does my entity have X component" is just a case of checking the component at the same index as the entity. Ofcourse you will have unused slots in the array but you are also never left wanting as at any point its possible to turn on a new component for an entity by enabling a component at a given index without the cost of an allocation etc. I believe it is also popular to have a bitfield in the entity to discern which components are enabled for it.

 

Each subsystem iterates over the components checking components[x]->IsEnabled() before processing them.




#5264870 Blending settings question

Posted by Dave on 04 December 2015 - 08:52 AM

You could use the stencil buffer to only draw where you havn't already drawn. Look up stencil buffer.






PARTNERS