• What Do You Need Help With? V6
    7,544 replies, posted
[QUOTE=Staneh;41330903]It's XNA, and will give an exception if I do.[/QUOTE] Are you using a VertexBuffer (And indices), and what's the exception [editline]5th July 2013[/editline] [QUOTE=WTF Nuke;41332041]I'm confused as to how you are supposed to transform normals. What if the model moves? Then what are you supposed to do? Change the light source position based on the model offset, but opposite? And what if the model scales uniformly or rotates? Then what do you do?[/QUOTE] You do know that normals don't change because a model moves right, they're the direction vector perpendicular to the surface
Right that's helping me understand it. Ok so I have a model, lets say I translate, rotate, and scale (uniformly) it. How would I modify the light source so that it works properly with this model?
[QUOTE=Staneh;41330775]What would be the best way to draw alot of vertices, would I divide parts of the vertices into chunks and draw them like that? I'm trying to create a big patch of terrain, but can't draw alot of vertices in one call.[/QUOTE] If you're using uints in your index buffer, you should be able to (theoretically) draw up to 4,294,967,295 unique vertices. And you're supposed to draw as many vertices as you can in as few draw calls as possible, there's overhead with each draw call you make. With large terrain, you could store all the vertices in a single VBO and use various index buffers / vertex attribute strides to achieve level of detail. With REALLY large terrain, you could store separate vertex buffers for different levels of detail and stream vertices in from the hard drive as you move around.
[QUOTE=Goz3rr;41332098]Are you using a VertexBuffer (And indices), and what's the exception [editline]5th July 2013[/editline] You do know that normals don't change because a model moves right, they're the direction vector perpendicular to the surface[/QUOTE] This is the exception: [img]http://puu.sh/3vXiG.png[/img]
[QUOTE=WTF Nuke;41332417]Right that's helping me understand it. Ok so I have a model, lets say I translate, rotate, and scale (uniformly) it. How would I modify the light source so that it works properly with this model?[/QUOTE] The light source doesn't need to be modified. You define the light source in a specific space (object space or eye space, typically) and transform your vertices and normals to that space. Vertices are simple, just multiply by your model or modelview matrix. Normals, as long as you're not doing non-uniform scaling, is simply multiplying the normal by the upper-left 3x3 of your model or modelview matrix. If you have non-uniform scaling, you need to take the inverse transpose of the upper-left 3x3 of your model or modelview matrix.
This is what I have so far [cpp]vec3 normCamSpace = normalize(mat3(V) * normal);" vec3 dirToLight = (V*vec4(lightPos, 0.0)).xyz;" float cosAngIncidence = clamp(dot(normCamSpace, dirToLight),0,1);"[/cpp] V = view model (or camera) Not sure what else I am supposed to do.
[QUOTE=Staneh;41332876]This is the exception: [img]http://puu.sh/3vXiG.png[/img][/QUOTE] Split it into multiple DrawUserIndexedPrimitives calls
I need a really simple database and I'm wondering what the best way to do it is. It'll just be timestamp / boolean / location of image / location of video. It will only be written to by a single program and read by a website served on the same PC. What should I do? SQL? Seems a bit much, and I'd have to learn how to use it.
A simple CSV-style text-format might be enough, or perhaps a structurally similar binary format. A more powerful, but still no "full-blown" (i.e. separate process) database would be something like LMDB/MDB or SQLite.
I'm currently learning OpenGL using LWJGL as my wrapper. I've reached the point where I want to load a model (or at least have the stuff in place for this), but to learn more I'm writing my own loader. I'm having a slight issue though in that my model (Suzanne) is loading in fine, but the output is 3x larger (not scale wise, but the vertex count triples). I've Pastebin'd the code; [url]http://pastebin.com/kkxvvxUB[/url] I can't see where it's replicating them, I know it's somewhere in the end of the parseFile() method, but fixDuplicates() should solve it.
You seem to have to work around it manually. With I presume glibc, va_list is just a pointer to the memory where the arguments are stored continuously ([url=http://stackoverflow.com/a/2210767/1874964]see this SO post[/url]). On MSVS you can apparently just modify the memory pointed to by &va_arg(list, type) ([url=http://gcc.gnu.org/ml/gcc-help/2001-10/msg00177.html]see this mail[/url]).
I mostly have a math question that google or myself can't seem to get the answer to. To invert an unsigned number (not -num), you would do (max - num). But how would you go about inverting a signed number?
Doesn't the same work for unsigned numbers? I don't fully understand what you're trying to do.
[QUOTE=ThePuska;41348160]Doesn't the same work for unsigned numbers? I don't fully understand what you're trying to do.[/QUOTE] Whoops, I mixed the terms. It works for unsigned, but how would I do it for signed?
You mean a bit-wise invert? Some languages have an operator for this, in C-like languages it might be ~. Or Lua for example has bit32.bnot. Otherwise -num - 1 should work for two's-complement representation. Depending on language/platform you need to look out to not overflow the integer if num == INT_MIN, since -INT_MIN is INT_MAX + 1.
If you mean inverting it with a given maximum value, surely your idea works with both? Let's say val = 3, max = 10... val = max - val (= 10 - 3) Now val = 7, like you wanted. Let's say val = -3, max = -10... val = max - val (= -10 - -3) Now val = -7, like you'd expect. Or is that not what you mean?
[QUOTE=Chris220;41352696]If you mean inverting it with a given maximum value, surely your idea works with both? Let's say val = 3, max = 10... val = max - val (= 10 - 3) Now val = 7, like you wanted. Let's say val = -3, max = -10... val = max - val (= -10 - -3) Now val = -7, like you'd expect. Or is that not what you mean?[/QUOTE] Yes, but what if the range is something like -10 to 10.
[QUOTE=vexx21322;41353929]Yes, but what if the range is something like -10 to 10.[/QUOTE] Can you give an example of this with your expected result? I can't quite figure out what you are trying to do.
[QUOTE=Chris220;41353987]Can you give an example of this with your expected result? I can't quite figure out what you are trying to do.[/QUOTE] While consulting a friend, they managed to help me through it. The formula I was seeking is simply: [code]-(num - mid) + mid[/code] He pointed out that what I was to wrap a number around a mid point. So with the mid point at 0; 1 inverted would be -1.
-snip- It was just more user error (syntax). Stupid is as stupid does.
Anyone here know some tricks about manipulating 2D Perlin Noise? I'm using it for terrain generation in a Stranded2-esque game, built in Love2D. Here is some pertinent information for the implementation I am using: I am using cosine interpolation, and a simple arithmetic-mean smooth (take the values of all the points about a point and dividing by 9). I am using the Lua engine's built-in PRNG, and using seeds in a manner like so: [code]function InitializePerlinNoise() PERLIN_CONSTANT_GENERATOR_SEED = os.time() --PERLIN_CONSTANT_GENERATOR_SEED = 5 math.randomseed(PERLIN_CONSTANT_GENERATOR_SEED) for i=1,PERLIN_OCTAVES do PERLIN_CONSTANTS[i] = math.random(0,5000) printf("Perlin constant %i is %i",i,PERLIN_CONSTANTS[i]) end end function PerlinNoiseFunction(x,y,iteration) if PERLIN_CONSTANTS[iteration] then math.randomseed(PERLIN_CONSTANTS[iteration] + ((x + (y * 5731)) * 514151 * iteration)) return (math.random(-100000000,100000000)/100000000) -- 8 decimals of precision should be sufficient. end end[/code] The below two images are both generated with a persistence of 1 and 8 octaves. The only settings difference between them is the "water" threshold. The first image has the water threshold at 0.3 (anything lower than it is colored blue and treated as water), and in the second, it is -0.3 [t]https://dl.dropboxusercontent.com/u/8416055/DeleteMe/Perlin002.jpg[/t] [t]https://dl.dropboxusercontent.com/u/8416055/DeleteMe/Perlin001.jpg[/t] It works okay for generating lots of tiny islands (or tiny lakes), but what I would like to see is a smoother transition - plots of land are larger when they appear, and plots of water are larger when they appear. Anyone know of any modifications to my Perlin I can attempt to make a more gradual shift in the values? Or should I incorporate some other operations to assist the Perlin-generated terrain? One thought I had was, to make an island, was to use Perlin to generate the "center" of the island, and then simply have all of the edge tiles be extrapolated outward with their "height" always brought down, so that eventually everything goes to deep ocean. I can share more of my Perlin terrain-generation code, if anyone feels it is necessary I do so. I just don't want to clutter the page if not necessary.
[QUOTE=Sombrero;41355293]I have a variable "created" in my program code, yet when the constructor initializes it as false, it's always set to true for an unknown reason.[/QUOTE] Can't say much without code. You can attempt to debug it.
[QUOTE=Matthew0505;41352949]I believe he is trying to "invert" a value by subtracting it from the maximum amount (ie. (~0 - value) or (-1 - value)), which has an identical result to simply bitflipping it with ~value [editline]8th July 2013[/editline] Can anybody recommend good programming languages optimised for making source-to-source compilers in?[/QUOTE] LLVM (compiler framework for C++) might interest you.
Can anyone explain me what is the problem here? [img]http://i.imgur.com/l8ikan8.png[/img] Chatters is a <UInt64,bool> dictionary
[QUOTE=superstepa;41366973]Can anyone explain me what is the problem here? [img]http://i.imgur.com/l8ikan8.png[/img] Chatters is a <UInt64,bool> dictionary[/QUOTE] ConvertToUInt64 is a method, which means you should put brackets after it: ConvertToUInt64()
[QUOTE=thf;41366998]ConvertToUInt64 is a method, which means you should put brackets after it: ConvertToUInt64()[/QUOTE] That is such a stupid mistake Thank you so much, no idea how I missed that
I am implementing .obj loading, but have run into some issues. How are you supposed to manage multiple usemtl statements? Should I have each usemtl be a different model in my engine? And what exactly are groups, objects, and smoothing groups (g, o, and s respectively)?
[QUOTE=WTF Nuke;41380586]I am implementing .obj loading, but have run into some issues. How are you supposed to manage multiple usemtl statements? Should I have each usemtl be a different model in my engine? And what exactly are groups, objects, and smoothing groups (g, o, and s respectively)?[/QUOTE] I group faces together by which usemtl they belong to (the last usemtl line). If you're making some kind of editor, groups and objects can be useful, if you're making an editor that can change surface normals, smoothing groups are useful to store. If it's just for a game where you only want to draw it as efficiently as possible, combine as much data as possible and ignore any extra information. But if you're asking how usemtl works, there should be an accompanying "mtllib" command at the beginning of the file that points to a .mtl file, which you can then use to parse materials. usemtl should have the same names as the materials defined in the mtl file.
Alright so I should make a new model for each usemtl group, as all those faces will use those settings? Then the model will store the newmtl data from the .mtl file, so that I can just draw each set of faces with their appropriate settings. Actually, I think I will have one model instance for each .obj file, and in it I will group faces with their usemtl group, so I can draw the whole model while still retaining usemtl groups. Can I keep all the data in the same buffer, then just do a drawElements call for the amount of items in a usemtl group, and then change uniform data?
The school that I'll start visiting mid-August will teach programming in Java. I already did some programming in C++, but due to C++'s nature I kinda stagnated to the point where I don't program at all(Note: C++ is also my first language). Now I thought about learning Java, as I will also need it in my new class and if I learn some Java before school starts I have a little advantage to anyone else and of course, I also want to do lots of programming as a hobby and for a living later on too. I've already heard about many different Java IDEs, but I still have no idea which one to choose and also saw that some actually cost money. Which free IDE can you guys recommend me? I could also need some good tutorial sites or videos(Though I prefer sites/documents or anything else that's in text form). Thanks in advance!
Sorry, you need to Log In to post a reply to this thread.