GPU code
#10
From a somewhat different perspective: I'd like to refactor most of the terrain generating code, because currently it's pulling the noise values somewhat slowly. I figured I could make a class that would hold the 2D or 3D array of noise values, define operations on that object first (such as "generate perlin", "clamp to", "add a constant to all", and "add another array"), then let it calculate all the values and finally use them. My point here is that this would allow us to refine the upscaling - the arrays could calculate all the operations in a smaller scale and then linearly upscale only the results. Quite a lot of generators take a noise, upscale it, and then do some math with it before using it.
Will such a class play nicely with your GPU optimizations? Could it perhaps act as the wrapper for various calculating backends (your method 4)?

Pseudocode example:
cValueArray2D<4, 4> Values(17, 17);  // 2D chunk-sized value array with 4x upscaling in each direction
Values.GeneratePerlin(...);
cValueArray2D<4, 4> Multiplier(17, 17);
Multiplier.GeneratePerlin(...);
Values.Multiply(Multiplier);
Values.Clamp(0, 1);
Values.MultiplyByConstant(80);
Values.AddConstant(40);
Values.Calculate();  // This does all the actual calculations
// Values are calculated in a 4x smaller version first (5*5 numbers),
// and the final results are then linearly upscaled to the full dimension (17*17 numbers)
Reply
Thanks given by:


Messages In This Thread
GPU code - by worktycho - 06-05-2014, 08:18 PM
RE: GPU code - by xoft - 06-05-2014, 08:27 PM
RE: GPU code - by worktycho - 06-05-2014, 08:40 PM
RE: GPU code - by worktycho - 06-06-2014, 02:54 AM
RE: GPU code - by tigerw - 06-06-2014, 03:03 AM
RE: GPU code - by xoft - 06-06-2014, 03:25 AM
RE: GPU code - by worktycho - 06-06-2014, 03:38 AM
RE: GPU code - by xoft - 06-06-2014, 05:33 AM
RE: GPU code - by worktycho - 06-06-2014, 05:49 AM
RE: GPU code - by xoft - 06-09-2014, 05:39 AM
RE: GPU code - by worktycho - 06-09-2014, 06:05 AM
RE: GPU code - by xoft - 06-09-2014, 06:09 AM
RE: GPU code - by worktycho - 06-09-2014, 07:21 AM
RE: GPU code - by worktycho - 06-09-2014, 08:46 PM
RE: GPU code - by NiLSPACE - 06-12-2014, 02:00 AM
RE: GPU code - by xoft - 06-12-2014, 02:17 AM
RE: GPU code - by worktycho - 06-12-2014, 02:55 AM
RE: GPU code - by worktycho - 06-13-2014, 02:19 AM
RE: GPU code - by bearbin - 06-13-2014, 02:38 AM
RE: GPU code - by worktycho - 06-13-2014, 02:42 AM
RE: GPU code - by LO1ZB - 06-13-2014, 04:12 AM
RE: GPU code - by tigerw - 06-13-2014, 04:33 AM
RE: GPU code - by worktycho - 06-13-2014, 04:43 AM
RE: GPU code - by tigerw - 06-13-2014, 05:09 AM
RE: GPU code - by worktycho - 06-13-2014, 05:14 AM
RE: GPU code - by bearbin - 06-13-2014, 06:09 AM
RE: GPU code - by worktycho - 06-15-2014, 04:21 AM
RE: GPU code - by xoft - 06-15-2014, 04:39 AM
RE: GPU code - by worktycho - 06-15-2014, 04:43 AM
RE: GPU code - by xoft - 06-15-2014, 05:01 AM
RE: GPU code - by bearbin - 06-15-2014, 06:36 AM
RE: GPU code - by worktycho - 06-15-2014, 06:36 AM
RE: GPU code - by xoft - 06-15-2014, 06:42 AM
RE: GPU code - by worktycho - 06-15-2014, 06:55 AM
RE: GPU code - by xoft - 06-15-2014, 11:08 PM
RE: GPU code - by worktycho - 06-18-2014, 12:57 AM
RE: GPU code - by worktycho - 06-18-2014, 01:12 AM
RE: GPU code - by NiLSPACE - 06-18-2014, 01:17 AM
RE: GPU code - by worktycho - 06-18-2014, 01:21 AM
RE: GPU code - by NiLSPACE - 06-18-2014, 01:30 AM
RE: GPU code - by worktycho - 06-18-2014, 01:34 AM
RE: GPU code - by NiLSPACE - 06-18-2014, 01:35 AM
RE: GPU code - by worktycho - 06-18-2014, 01:36 AM
RE: GPU code - by worktycho - 06-18-2014, 05:27 AM
RE: GPU code - by bearbin - 06-18-2014, 05:41 AM
RE: GPU code - by worktycho - 06-18-2014, 06:03 AM
RE: GPU code - by worktycho - 06-19-2014, 05:39 AM
RE: GPU code - by LO1ZB - 06-19-2014, 09:12 AM
RE: GPU code - by NiLSPACE - 06-19-2014, 05:50 AM
RE: GPU code - by LO1ZB - 06-19-2014, 05:59 AM
RE: GPU code - by worktycho - 06-19-2014, 06:27 AM
RE: GPU code - by LO1ZB - 06-19-2014, 07:11 AM
RE: GPU code - by worktycho - 06-19-2014, 07:28 AM
RE: GPU code - by LO1ZB - 06-19-2014, 07:35 AM
RE: GPU code - by worktycho - 06-19-2014, 07:51 AM
RE: GPU code - by xoft - 06-19-2014, 04:33 PM
RE: GPU code - by worktycho - 06-19-2014, 10:07 PM
RE: GPU code - by xoft - 06-20-2014, 12:43 AM
RE: GPU code - by worktycho - 06-20-2014, 01:01 AM
RE: GPU code - by xoft - 06-20-2014, 01:06 AM
RE: GPU code - by worktycho - 06-20-2014, 01:10 AM
RE: GPU code - by xoft - 06-20-2014, 02:24 AM
RE: GPU code - by worktycho - 06-20-2014, 02:32 AM
RE: GPU code - by Schwertspize - 10-30-2015, 03:50 AM
RE: GPU code - by worktycho - 10-30-2015, 07:39 AM
RE: GPU code - by DiamondToaster - 10-30-2015, 10:04 AM



Users browsing this thread: 20 Guest(s)