SceneKit change color of materials programmatically - scenekit

My googling skills have failed me on this one so if this is an obvious question please forgive me.
I am trying to create one of those typical rpg character creation screens. I have a model, I have base diffuse maps, and let's say I want to change the model's hair color. I can set the diffuse to a different color (instead of the diffuse texture) and it works but it loses all those small details. For example, if I were to change the eyes, they would just be a solid color.
Is there a correct way to go about editing these colors? Is there something I specifically need in my diffuse maps? Another texture? etc?

After researching how general textures work I solved my issue and maybe this will help others:
Inside SceneKit you get to choose a Diffuse, Emission, Normal, etc for textures. If you choose a specific color for the diffuse you'll lose any sort of texture/material/detail of that texture because it's a solid color. For example, if you were making a coin model, and the head of the coin was in your diffuse; changing the diffuse to a solid color will give you a solid colored coin with no detail. The way I solved this was adding a normal map with the details.
With the normal map, you can change the diffuse to a solid color, and the details of the models are showed through the normal map; resulting in any color coin.

Related

How to go about changing the tint color of an image?

Sorry for the vague title, I have no idea how to really ask this question to be honest so I'll describe what I'm trying to do
I'm attempting to make an app where users can change the colors of different parts of a car. They can change the door for instance to a green as shown, or any other color they wish. They would then be able to change the color of the hood, or the roof, etc.
I've thought about having seperate images for each component and then lining them up to match. However this seems practically impossible when it comes to different screen sizes and scales. I also thought about making a blanket white image, and then creating views over the top with the selected color.
Does anyone have any ideas how I could possibly approach this?
Thankyou
I dont know about the performance of this. But, how about, an overlay of the different parts of the car, but using the same size of the whole car. For example, you have the image of the whole car, and erase all but the door. In other image, you erase all but the hood. If you lay one image above another, it will make the whole car, and the size of the screen will not affect you, because all the images will have the same size.
Then you can use the tint style to change the color of each layer.

Unable to change ColorPalette property on Telerik Report graph

I'm using the Telerik Reports graph wizard to create a bar chart. Even though I can change the ColorPalette property to GradientPalette and can choose the desired colors, the results are the same flat single color. What am I doing wrong? Thanks for your help and advice.
The Graph's Color Palette applies gradient coloring on the whole series, not on each of the the data points. I believe you're trying to achieve gradient-colored bars, but this feature is not supported. If in your bar chart you define series groups, then the first bar will be colored using the palette's BeginColor, the last bar will be colored with the palette's EndColor all the bars between them will have solid color, calculated based on their count and offset from the BeginColor towards the EndColor.
The Gradient Palette makes much sense when used in the Choropleth, where the color represents an additional data measure - see a demo here.

linear gradient x proportion codenameone

i am using linear gradient horizontal. I want to use more of the starting gradient color than ending one. Presently both color have equal proportion ie meet in the center. How can i get more of one color than the other? Also i came to know that setBackgroundGradientRelativeX etc method only applies to radial gradient not linear one. Moreover i have lots of various simple gradients in the designs, so i dont want to use images everywhere. It would be troublesome.
categoryTitle.setUIID("partyCategoryTitle");
categoryTitle.getAllStyles().setBackgroundGradientStartColor(0x73a0ff);
categoryTitle.getAllStyles().setBgImage(null);
categoryTitle.getAllStyles().setBackgroundGradientEndColor(0xffffff);
categoryTitle.getAllStyles().setBackgroundGradientRelativeX(1);
categoryTitle.getAllStyles().setBackgroundGradientRelativeY(10);
categoryTitle.getAllStyles().setBackgroundType(Style.BACKGROUND_GRADIENT_LINEAR_HORIZONTAL);
As gradients currently don't really work on Android I'd avoid it.
I can't stress enough how badly gradients perform in the current implementation when they do work. Adding features to something that isn't working properly at this time is not a priority.

Changing color of an image - at runtime

Im going to make a new application for a car dealership. They basically want a WPF/silverlight application where one can slect a car (model) and then via a color palette choose the color of the car (from predefined colors). They also need to be able to different kind of rims, headlights and interior.
what is the best/easiest approach for this. Been thinking on having all the different images and then just swap them out when the selection changes. This, however has the potentional problem of all images with all combinations does not exist (eg. a red VW, metallic rims, white leather interior) etc.
Is there any other approach to this? replacing colors? Having a basic model and then copying the "body" of the car on top, copy rims on top etc. and then just having to enable/disable a particular "layer" of the images?
I would do this by using different layers: the basic model with the car's color as translucent part, on top of this pictures with the different add-ons, the background color is the car's color. The trick is to fit everything together that it looks good.
Depending on the color (maybe you want to have shadows or chrome effects), you could have one model's picture for each color, and then add the add-ons and the interior on top of this.

How to interpolate between colors for a polygon in Bing Maps

I have a WPF application with the Bing Maps API. What I have is a polygon rendering on many countries as well as real time statistics being display. I'm using this to keep track of where my server traffic is mainly coming from. The project is coming along nicely, but I hit a small roadblock. What I have are polygons that go from green to red and vice versa if there is a change in the statistics. If someone logs off then it would go into the green, if someone logged on it would go into the red. What I'd like to do is given a set number of users, let's say 20, I can gradually change the colors over a period of a second.
An example is 0 would be green and 20 would be red. So 10 would be yellow. With this, is there a way to gradually change colors?
Thanks in advance
There might be a fancy way of doing what you are looking for in xaml, but I imagine it would be a lot easier to to just have the color of the polygon bound to a property in your viewmodel/code-behind and then update the color whenever necessary.
For color interpolation, there is another SO question on it here.

Resources