We get it. We use ad blockers too. But GameDev.net displays them so we can continue to be a great platform for you.
Please whitelist GameDev.net and our advertisers.
Also consider a GDNet+ Pro subscription to remove all ads from GameDev.net.
Subscribe to GameDev.net's newsletters to receive the latest updates and exclusive content.
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
Posted 22 January 2013 - 03:40 AM
Posted 22 January 2013 - 05:44 AM
Look at the bottom right of the first quad. There are four different colours around the vertex. If those four quads are sharing a vertex, how can they get different colours at the same point?There are mustn't be 4 different corors around 1 vertex. Oposite, there are must be one color on the 4 quads (near this vertex)
Also, the left and right edges of each quad are the same colour, when they ought to be different.
Edited by Yura, 22 January 2013 - 05:44 AM.
Posted 22 January 2013 - 06:18 AM
How about you recreate the entire texture as a lookup table in the pixel shader and then sample it like this: out.color = colors[round(texCoords.x * 11)]?
const float3 colors[] = { float3(0.f, 0.f, .5f), float3(0.f, .23f, .73f), float3(0.f, .45f, .95f), float3(0.f, .68f, 1.f), float3(0.f, .9f, 1.f), float3(0.f, 1.f, .73f), float3(0.f, 1.f, .27f), float3(.23f, 1.f, 0.f), float3(.63f, 1.f, 0.f), float3(1.f, .91f, 0.f), float3(1.f, .45f, 0.f), float3(.93f, .11f, .14f), }
Good idea, it works, but the same as a texture (look at picture "I receive this" at the begining of post).
Is it possible to modificate it to receive the result I want?
Posted 22 January 2013 - 07:59 AM
There are mustn't be 4 different corors around 1 vertex. Oposite, there are must be one color on the 4 quads (near this vertex)
Perhaps it's best if you post the code that shows how you set up the quads' vertex positions and their accompanying temperature-texcoords. Like said before, it's probably something in there that's causing these unwanted discontinuities.
Posted 22 January 2013 - 08:23 AM
There are mustn't be 4 different corors around 1 vertex. Oposite, there are must be one color on the 4 quads (near this vertex)
Perhaps it's best if you post the code that shows how you set up the quads' vertex positions and their accompanying temperature-texcoords. Like said before, it's probably something in there that's causing these unwanted discontinuities.
Ofcourse, if it would help...
So, I initialize VertexBubber with data in "points":
for (int j = 0; j < list.Count; j++) { points.Add(new Vertex() { Coord = new Vector2(chooser.GetTexture1DCoordinate(elements[i].valueOnPoint[j]), 0), Position = new Vector3(list[j].X, list[j].Y, list[j].Z), }); }
And here is ColorChooser.GetTexture1DCoordinate method, which takes load on vertex as input information and returns tenture coordinate on each point:
public class ColorChooser { public ColorChooser(float min, float max) { MaxValue = max; MinValue = min; float step = (Math.Abs(min) + Math.Abs(max)) / lvlCount; float nextStep = min; levels[0] = min; for (int i = 1; i < lvlCount - 1; i++) { nextStep += step; levels[i] = nextStep; } levels[lvlCount - 1] = max; } public float GetTexture1DCoordinate(float val) { if ((val >= levels[0]) && (val < levels[1])) { return 0.06f; } if ((val >= levels[1]) && (val < levels[2])) { return 0.164f; } if ((val >= levels[2]) && (val < levels[3])) { return 0.244f; } if ((val >= levels[3]) && (val < levels[4])) { return 0.336f; } if ((val >= levels[4]) && (val < levels[5])) { return 0.425f; } if ((val >= levels[5]) && (val < levels[6])) { return 0.576f; } if ((val >= levels[6]) && (val < levels[7])) { return 0.66f; } if ((val >= levels[7]) && (val < levels[8])) { return 0.74f; } if ((val >= levels[8]) && (val < levels[9])) { return 0.832f; } if ((val >= levels[9]) && (val < levels[10])) { return 0.904f; } if ((val >= levels[10]) && (val < levels[11])) { return 0.986f; } if ((val >= levels[11]) && (val < levels[12])) { return 0.999f; } else { return 0.999f; } } }
Posted 22 January 2013 - 09:18 AM
Posted 22 January 2013 - 09:43 AM
But is it important? Point will be added several times (for each rectangle) but with same texCoords...It may be. When you iterate over all the points (for (int j = 0; j < list.Count; j++)), including the duplicates, they may no longer match up with what you have stored in 'elements[i].valueOnPoint[]' when you index it with 'j'.
Edited by eppo, 22 January 2013 - 09:44 AM.
Posted 23 January 2013 - 02:03 AM
It may be. When you iterate over all the points (for (int j = 0; j < list.Count; j++)), including the duplicates, they may no longer match up with what you have stored in 'elements[i].valueOnPoint[]' when you index it with 'j'.
But is it important? Point will be added several times (for each rectangle) but with same texCoords...
No, they matches well, becouse "list" is an "element[i]".
Sorry if I confused you.. Element class is representing quad (points and data) and Node class is representing point (coordinates).
for (int i = 0; i < elements.Length; i++) { List list = elements[i].Nodes; for (int j = 0; j < list.Count; j++) { points.Add(new Vertex() { Coord = new Vector2(chooser.GetTexture1DCoordinate(elements[i].valueOnPoint[j]), 0), Position = new Vector3(list[j].X, list[j].Y, list[j].Z), }); } }
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.
GameDev.net™, the GameDev.net logo, and GDNet™ are trademarks of GameDev.net, LLC.