Results 1 to 10 of 10
  1. #1
    Iron Guard
    Join Date
    Jun 2008
    Posts
    818
    Gamer IDs

    Gamertag: Black Fang666

    Question Get average RGB color of an object

    I would like to be able to get a color value in one of the following ways.

    From a specific point on a lit object.

    From a specific point on the diffuse map of an object.

    By projecting from a specific point on an object to get a pixel's rgb on the screen.

    By getting the material of the object, and getting an average color from the diffuse.

    Does anyone have any idea on how to get started with any of these methods, or any that I did not think of. I basically want to get a few color values from points around the player to get an idea of what the average color in around him is, which can then be used to determine how well his camo matches.
    Want to collaborate? Want to chat UDK? Message me on Skype, Craig Delancy. Check out my UDK Youtube channel: http://www.youtube.com/user/xblBlack...ew=0&flow=grid

  2. #2
    Iron Guard
    Join Date
    Jun 2008
    Posts
    818
    Gamer IDs

    Gamertag: Black Fang666

    Default

    Ant ideas, I know I can get the material from a trace. Is there any way to get an average idea on what color that material is?
    Want to collaborate? Want to chat UDK? Message me on Skype, Craig Delancy. Check out my UDK Youtube channel: http://www.youtube.com/user/xblBlack...ew=0&flow=grid

  3. #3
    Iron Guard
    Join Date
    Jun 2008
    Posts
    818
    Gamer IDs

    Gamertag: Black Fang666

    Default

    Im' pretty sure that the third method is somewhat possible, just need a little push in the right direction.
    Want to collaborate? Want to chat UDK? Message me on Skype, Craig Delancy. Check out my UDK Youtube channel: http://www.youtube.com/user/xblBlack...ew=0&flow=grid

  4. #4
    MSgt. Shooter Person
    Join Date
    Sep 2010
    Location
    Slovakia
    Posts
    483

    Default

    Trace returns you actor. When you have actor you can acces component and when you have compoenent you can acces material. But i don't have idea how to get average value but I think it is not imposible.
    Czech and Slovak UDK site - www.udk-site.net-core.eu
    Space Shock project on STEAM GREENLIGHT

  5. #5
    Veteran
    Join Date
    Sep 2006
    Location
    Newcastle, UK
    Posts
    6,942
    Gamer IDs

    Gamertag: ambershee

    Default

    You can't get this information in Unrealscript.
    - Please do not send me questions regarding programming or implementing things in UDK via Private Message. I do not have time to respond and they are much better answered in the forums. -

  6. #6
    MSgt. Shooter Person
    Join Date
    Jul 2011
    Location
    Shanghai
    Posts
    309

    Default

    Third-party program and DLLBind could possibly achieve this, but it'd be pretty difficult. But, like ambershee said, no way with just Unrealscript.

  7. #7
    Iron Guard
    Join Date
    Jun 2008
    Posts
    818
    Gamer IDs

    Gamertag: Black Fang666

    Default

    I suppose so... I could add a linear color variable in the actor class and call it AverageColor... I just don't generally like tampering in classes that far up in the hierarchy. Plus it would have to be set on everything per instance... Which means I might as well try to do it with a volume... If I am only checking static meshes, I could add something that could be set in the static mesh editor window...
    Want to collaborate? Want to chat UDK? Message me on Skype, Craig Delancy. Check out my UDK Youtube channel: http://www.youtube.com/user/xblBlack...ew=0&flow=grid

  8. #8
    Veteran
    Join Date
    Sep 2006
    Location
    Newcastle, UK
    Posts
    6,942
    Gamer IDs

    Gamertag: ambershee

    Default

    Yeah, you can't do that either because Static Meshes only really exist as a pseudotype in UnrealScript and the StaticMeshActor class is native. You'd have to create a subclass.
    - Please do not send me questions regarding programming or implementing things in UDK via Private Message. I do not have time to respond and they are much better answered in the forums. -

  9. #9
    Iron Guard
    Join Date
    Jun 2008
    Posts
    818
    Gamer IDs

    Gamertag: Black Fang666

    Default

    I could just use the wireframe color and set it in editor. Then exclude meshes that still have the default blue.
    Want to collaborate? Want to chat UDK? Message me on Skype, Craig Delancy. Check out my UDK Youtube channel: http://www.youtube.com/user/xblBlack...ew=0&flow=grid

  10. #10
    Redeemer
    Join Date
    Dec 2008
    Location
    Germany
    Posts
    1,232

    Default

    You could also use a setup like this (although this results in many more actors being placed in the level):
    Code:
    class AverageColorActor extends Actor
    	placeable;
    
    var() color AverageColor;
    
    var() Actor AttachTo;
    
    function PostBeginPlay()
    {
    	if (AttachTo != none)
    	{
    		//attach ourself to AttachTo, so we are able to get a reference to this AverageColorActor (and its AverageColor attribute).
    		//Say we have a reference to an Actor, which may be aquired using Trace() or similar, we pass it to the static function below and get an AverageColorActor (or none) back.
    		AttachTo.Attach(self);
    	}
    }
    
    //returns the first AverageColorActor that is attached to anActor
    static final function AverageColorActor findActorInAttached(Actor anActor)
    {
    	local int i;
    
    	if (anActor != none)
    	{
    		for (i = 0; i < anActor.Attached.length; i++)
    		{
    			if (AverageColorActor(anActor.Attached[i]) != none)
    			{
    				return AverageColorActor(anActor.Attached[i]);
    			}
    		}
    	}
    
    	return none;
    }
    Last edited by UnrealEverything; 08-07-2012 at 08:45 AM.
    2B || !(2B)


 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Copyright ©2009-2011 Epic Games, Inc. All Rights Reserved.
Digital Point modules: Sphinx-based search vBulletin skin by CompletevB.com.