Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411414 Posts in 69360 Topics- by 58415 Members - Latest Member: sophi_26

April 16, 2024, 12:32:26 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)The happy programmer room
Pages: 1 ... 189 190 [191] 192 193 ... 279
Print
Author Topic: The happy programmer room  (Read 677498 times)
8BitPimp
Level 0
**


View Profile WWW
« Reply #3800 on: July 30, 2014, 09:38:20 AM »

I ported Notch's Minecraft4K javascript demo to C++ and SDL  Smiley

The source is there for anyone who is interested in 3D raycasting.

http://the8bitpimp.wordpress.com/2014/07/30/minecraft-4k-c-port/
Logged

RandyGaul
Level 1
*

~~~


View Profile WWW
« Reply #3801 on: July 30, 2014, 12:51:36 PM »

Threaded the island solving in my physics engine Smiley

It was pretty rough as I ended up finding some ginormous (and old) bugs from uninitialized memory. Implementing the threading shed light onto the crazy memory bugs... But it's all working now!
Logged
Sik
Level 10
*****


View Profile WWW
« Reply #3802 on: July 30, 2014, 03:15:31 PM »

I do want to pose a question:

I only have 8 bits to work with for 3 variables (gloss, roughness, specular amount) in the BRDF.  If I can find a way to mess deeper with Unity's deferred lighting system (perhaps impossible), then I can get another 8 bits (by cramming the normal into 16 bits instead of 24).  With 16 bits, I'd feel comfortable with ~5 bits per variable, but with 8 bits, ~2 bits per variable leaves a bit wanting.  
Now, the question comes, should I just use a look up table?  

I can only have 256 distinct triplets (barring interpolating between things), but I imagine that for my own personal uses I can easily get away with 256 distinct reflectance parameters (pretty much all metals can use the same one, so too with high gloss things like car paint, so I can cram a lot of different materials into that range).

If you have the X and Y axes of the normal you can compute the Z axis from them. I don't remember the exact calculation out there but it's a common trick to reduce space usage, so it shouldn't be hard to search. This means that with 16 bits you'd get two 8-bit values instead of three 5-bit values (and with 8 bits you'd get two 4-bit values instead of three 2-bit values).
Logged
standardcombo
Level 8
***


><)))°>


View Profile
« Reply #3803 on: July 30, 2014, 06:24:57 PM »

I'm a grumpy programmer and I came here to see if I can become happy. Lips Sealed
Logged

manabreak
Level 0
***


dManabreak @ Twitter


View Profile
« Reply #3804 on: July 30, 2014, 08:18:40 PM »

Managed to create a tiny C++ project from scratch and run it on Windows, Android and Windows Phone 8 successfully, with platform-specific code and common interface. Cross-platform games, here I come!
Logged
8BitPimp
Level 0
**


View Profile WWW
« Reply #3805 on: July 31, 2014, 02:50:27 AM »

I do want to pose a question:

I only have 8 bits to work with for 3 variables (gloss, roughness, specular amount) in the BRDF.  If I can find a way to mess deeper with Unity's deferred lighting system (perhaps impossible), then I can get another 8 bits (by cramming the normal into 16 bits instead of 24).  With 16 bits, I'd feel comfortable with ~5 bits per variable, but with 8 bits, ~2 bits per variable leaves a bit wanting.  
Now, the question comes, should I just use a look up table?  

I can only have 256 distinct triplets (barring interpolating between things), but I imagine that for my own personal uses I can easily get away with 256 distinct reflectance parameters (pretty much all metals can use the same one, so too with high gloss things like car paint, so I can cram a lot of different materials into that range).

If you have the X and Y axes of the normal you can compute the Z axis from them. I don't remember the exact calculation out there but it's a common trick to reduce space usage, so it shouldn't be hard to search. This means that with 16 bits you'd get two 8-bit values instead of three 5-bit values (and with 8 bits you'd get two 4-bit values instead of three 2-bit values).

Yes you should be able to take the cross product of X and Y to find Z.  If X and Y are unit vectors then the derived Z vector should be unit also IIRC so you dont even have to normalize.  I think thats quite a common optimization to store a normal map using only two channels.

Perhaps you could take it even farther and have a 8bit lookup table of normals which would also avoiding the calculation of the cross product.  Perhaps the quantization would look too ugly though.
Logged

MorleyDev
Level 0
***

"It is not enough for it to just work"


View Profile WWW
« Reply #3806 on: July 31, 2014, 08:41:17 AM »

Finally clawed my well out of callback hell and refactored some node.js code to use promises. The end result is code that is easier to read, easier to test, and more closely follows SOLID principles.

Let us never speak of the horror of the 5-level deep nested callbacks again.
Logged

standardcombo
Level 8
***


><)))°>


View Profile
« Reply #3807 on: July 31, 2014, 02:32:49 PM »

Yikes, I can remember having a similar callback nightmare back in a facebook project. Debugging was not a strength of AS3.
Logged

Fallsburg
Level 10
*****


Fear the CircleCat


View Profile
« Reply #3808 on: August 01, 2014, 05:07:08 AM »

If you have the X and Y axes of the normal you can compute the Z axis from them. I don't remember the exact calculation out there but it's a common trick to reduce space usage, so it shouldn't be hard to search. This means that with 16 bits you'd get two 8-bit values instead of three 5-bit values (and with 8 bits you'd get two 4-bit values instead of three 2-bit values).
Well, the problem is Unity. I know of that trick, it's just whether I have enough control over Unity's rendering system to control how the depth/normals are written. I haven't done the digging to find that out yet.
Logged
MorleyDev
Level 0
***

"It is not enough for it to just work"


View Profile WWW
« Reply #3809 on: August 01, 2014, 05:30:18 AM »

Yikes, I can remember having a similar callback nightmare back in a facebook project. Debugging was not a strength of AS3.

Yeah, I've found the issue with callbacks is you lack a stack, so it's very difficult to avoid either repeating code or having to call the same function in multiple paths, so the exact same error handling code gets sprinkled around like pixie-dust. Then you have to make sure you only call the callback once (some prominent js libraries have had bugs where that didn't happen) and it's not as immediately obvious where that 'exit point' is compared to a standard function call.

There are ways around this that still use callbacks, but promises let you get around it nicely and in a way that I find a lot easier to follow, since it produces a code-flow that is a pipeline of sequential steps that return and process data. It appeals to me Smiley
« Last Edit: August 01, 2014, 06:01:45 AM by MorleyDev » Logged

Slader16
Level 8
***



View Profile
« Reply #3810 on: August 01, 2014, 09:04:33 AM »

Just learned about indexes, for example:
"Tigsource"[2]

Would print "g".

I had no idea I could do that, even though I'm a pretty decent programmer Who, Me?
Logged

framk
Level 2
**


I don't know anything


View Profile
« Reply #3811 on: August 01, 2014, 02:12:48 PM »

That's a pretty integral part of programming. How have you gone so long without it?
Logged

Sik
Level 10
*****


View Profile WWW
« Reply #3812 on: August 01, 2014, 08:29:21 PM »

Not all languages let you do that (some require you to use a function instead).
Logged
Geti
Level 10
*****



View Profile WWW
« Reply #3813 on: August 01, 2014, 09:12:18 PM »

Slader do you mean indexes in general or just that you could apply them to strings in c/++ due to strings being char pointers? If you mean indexes in general you really need to like, look into basic data structures and algorithms. I would not call anyone oblivious to arrays a decent programmer.
Logged

Sik
Level 10
*****


View Profile WWW
« Reply #3814 on: August 01, 2014, 10:00:54 PM »

Considering how he explicitly showed them being used on a string to retrieve an individual character, I assume he meant using indexes in strings (which is probably rather obvious to a C or C++ programmer, but not that obvious on higher level languages where strings are not treated as arrays).
Logged
InfiniteStateMachine
Level 10
*****



View Profile
« Reply #3815 on: August 02, 2014, 08:59:59 AM »

That would be my assumption too. It's been a little while since I've used java but you can't use the index operator on a java string right?
Logged

Geti
Level 10
*****



View Profile WWW
« Reply #3816 on: August 02, 2014, 06:14:28 PM »

treated as arrays
They're not just "treated as" arrays, they are arrays.
Logged

Sik
Level 10
*****


View Profile WWW
« Reply #3817 on: August 02, 2014, 06:26:29 PM »

Not in some languages, that was my point =P (I'm aware that they're literally arrays of char in C and C++)
Logged
Agumander
Level 0
*


View Profile WWW
« Reply #3818 on: August 02, 2014, 07:27:52 PM »

Once you've been made to peer into the abyssal home of the old gods implement a memory allocator, it's all char arrays and a few helper functions anyway.
Logged
Garthy
Level 9
****


Quack, verily


View Profile WWW
« Reply #3819 on: August 02, 2014, 08:04:50 PM »

Conceivably, if you started out with any language lacking both operator overloading and providing specific string index get/set calls, perhaps even did most of your development on existing large codebases, then you could find yourself going a long time without ever needing string indexing via an array-style operator. You could still be quite skilled, just never had a need to use them.

It would be an unusual path to travel for sure, but it looks like at least one person has done just that!
« Last Edit: August 02, 2014, 11:44:14 PM by Garthy » Logged
Pages: 1 ... 189 190 [191] 192 193 ... 279
Print
Jump to:  

Theme orange-lt created by panic