Submit
In response to GLSL and different GPUs
B5262118b588a5a420230bfbef4a2cdf
1
Stainless 151 Dec 30, 2013 at 11:28

A lot of commercial games use a shader bank.

They all call it different things, but in general they create a few flags to cover everything they need to know about the client platform. Things like if the device supports context less surfaces, how many instructions per shader, etc.

Then they load shaders based on those flags.

In response to reply on OpenGL matrix
B5262118b588a5a420230bfbef4a2cdf
0
Stainless 151 Dec 30, 2013 at 11:22

So you don’t want to pitch the camera up and down? You want the camera to rise and fall instead?

Zoom is easy, just increase or decrease the field of view Rotating around the vertical is easy, take a forward vector and rotate it by the current heading

Then just create a look at matrix from the camera position towards the rotated forward vector. Create a perspective matrix with the desired field of view and you are away.

When you have it working, a neat trick is to zoom in and move the camera at the same time to get the famous horror movie camera trick.

In response to OpenGL matrix
88dc730f0f71e55be39de0ad103bd9ff
0
Alienizer 109 Dec 30, 2013 at 04:28

Yes, but I do want to rotate, pan and zoom, just like in ortho view!

In response to reply on OpenGL matrix
A8433b04cb41dd57113740b779f61acb
0
Reedbeta 167 Dec 30, 2013 at 04:12

It’s not something you do with a matrix. That’s down to the controls. You just don’t let the user tilt it up or down.

In response to OpenGL matrix
88dc730f0f71e55be39de0ad103bd9ff
0
Alienizer 109 Dec 30, 2013 at 03:35

So how do you set such matrix to keep the camera horizontal?

In response to OpenGL matrix
A8433b04cb41dd57113740b779f61acb
1
Reedbeta 167 Dec 30, 2013 at 03:03

I think I remember a StackOverflow question about this once. IIRC, two-point perspective is just regular pinhole perspective where you’re looking at a scene that has lots of vertical lines (like buildings, fence posts, etc), and you keep the camera horizontal, not tilting it up and down. That way vertical lines in the scene are guaranteed to be mapped to vertical lines on screen.

(You can actually still get a form of vertical camera motion by shearing the frustum up and down rather than tilting - since it keeps vertical lines vertical that way.)

The matrix for it would be the same as the regular perspective projection, since it’s just a restriction that the camera be horizontal.

In response to GLSL and different GPUs
A8433b04cb41dd57113740b779f61acb
2
Reedbeta 167 Dec 29, 2013 at 19:54

A common trick is to hide away the version-specific stuff using macros or wrapper functions, like

#if __VERSION__ < 400
    vec4 Foo(vec4 bar) { /* GL 3.x implementation */ }
#else
    vec4 Foo(vec4 bar) { /* GL 4.x implementation */ }
#endif

When you compile the shader, since multiple source strings can be put in, you can put the #version directive in the first string and the rest of the source in another string. Select the correct #version for the platform you’re running on, and the preprocessor does the rest.

At my last job we used this to hide differences between HLSL and PSSL (the PS4 shading language), so we could write shaders to work in either one. It worked reasonably well.

117d385ca7305f161dce4d680d2ea63c
0
piradyne 102 Dec 29, 2013 at 18:03

This is how I made the integrated help system in GamePascal.

In response to reply on a new programming style
B5262118b588a5a420230bfbef4a2cdf
0
Stainless 151 Dec 28, 2013 at 08:43

A MOB is just a Moveable Object Block, what most people now would call sprites I guess.

It was used in MOS Technology’s graphics chip literature (data sheets, etc.) However, Commodore, the main user of MOS chips and the owner of MOS for most of the chip maker’s lifetime, applied the common term “sprite”, except for the Amiga line of home computers, where MOB was the preferred term.

In response to reply on a new programming style
Fd80f81596aa1cf809ceb1c2077e190b
0
rouncer 103 Dec 27, 2013 at 15:06

hmmm, well, a mob might be better, but what are they exactly?

3c4c0586aa3b3ad4acdeed79d190bb7d
1
Skye 102 Dec 27, 2013 at 02:05

I may use something called Jmonkey. It seems to have what I want, plus it’s commands are easier to follow.

@Override public void requestClose(boolean esc) { if (!esc){ System.out.println(“The game was quit.”); }else{ System.out.println(“Player has Collided. Final Score is “ + Score); } context.destroy(false); }”

3c4c0586aa3b3ad4acdeed79d190bb7d
0
Skye 102 Dec 27, 2013 at 01:41

Eh Hero doesn’t look that great, but isn’t free.. Yet cryengine/unrealengine is : /

194653f6bf54cad70a7cf97e6b7f35a4
0
benrawlesmusic 101 Dec 26, 2013 at 22:53

Hope you’re having a great holiday, and are looking forward to the new year! All the best :)

A638aa42130293f319eda7fa4ba121f4
0
fireside 141 Dec 26, 2013 at 21:50

If you are talking MMO, your best bet would be Hero Cloud.

In response to A voxel renderer
40fd50c8665e5b5f4233e4c0587a9d47
0
17_Gen_r 105 Dec 26, 2013 at 14:34

It is fast now (archive kept up to date until UD floored). UD is not a secret anymore.

For there is nothing covered, that shall not be revealed; neither hid, that shall not be known. (Luke 12.2)

In response to reply on a new programming style
B5262118b588a5a420230bfbef4a2cdf
1
Stainless 151 Dec 26, 2013 at 11:04

Just think about a real game, say 100 different types of MOB’s.

Just think of what a incredible mess it would be. At least 100 if statements, and if you wanted to change something for one MOB you could accidentally change all of them.

Code maintenance would be a nightmare, debugging would be a nightmare. I see no advantages at all for this approach and hundreds of disadvantages

You can do any kind of morphing you want with much cleaner code.

MOB (Moveable Object Block) old coders should remember them

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 167 Dec 26, 2013 at 00:21

The OS is supposed to balance threads across cores by itself. It may take it a little while to get the distribution right, once you start up your threads.

It still pays to try to divide the work evenly across threads. If you have one thread doing much more work than the others, the OS can’t help you with that.

The i7 CPUs mostly have hyperthreading (2-way simultaneous multithreading) while i5 doesn’t. The OS still takes care of thread distribution though.

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 167 Dec 26, 2013 at 00:05

What do you mean by “does it work”?

Certainly you can issue a bunch of writes, but you typically have to do some kind of barrier operation to ensure that they can be seen by other CPU cores, or other devices on the system (e.g. I/O devices, or the GPU).

A8433b04cb41dd57113740b779f61acb
0
Reedbeta 167 Dec 25, 2013 at 23:58

You can not have specular highlight with area lights using pure reflection

Yes you can. Reflected rays will hit the area light, and since it has an bright emissive color (that’s what makes it a light), that color will be reflected in the surface, forming a specular highlight.

I have no idea what you’re talking about with “the reflective part of the refraction algorithm”. Reflection is reflection. Is this something to do with Fresnel?

88dc730f0f71e55be39de0ad103bd9ff
1
Alienizer 109 Dec 25, 2013 at 22:48

how would shininess work?

Only use the reflection factor of the refraction function. For example, for all your shiny materials, set an IOR value of 2 (or more if you want very shiny) and treat your material as if it was glass, except you don’t refract, only reflect. use the Russian roulette to determine when it will reflect. When you calculate the reflection and refraction, and you get say reflection=0.3 and refraction=0.7 then use a random number (0..1) and test against the reflection value, if it’s lower, do the full reflection, if higher, do nothing as if the surface was not shiny at all. Or you could reflect all the time but scale your RGB by the reflection value, i.e. RGB *= ReflectionValue to attenuate the reflection accordingly or else it’ll be a pure mirror, not shiny.

Ceee4d1295c32a0c1c08a9eae8c9459d
1
v71 105 Dec 25, 2013 at 17:13

If that was true i should be at amoeba level by now

B20d81438814b6ba7da7ff8eb502d039
2
Vilem_Otte 117 Dec 25, 2013 at 12:24

Just a reaction - I guess you’re talking about non-physically based ray tracer.

Inside physically based ray tracer you don’t actually do specular highlighting, they are naturally produced by reflectivity of the surface. Of course you have to use enough samples to create smooth highlight on semi-reflective surface -> perfectly reflective surface with black albedo (e.g. totally perfect mirror) don’t have ANY specular highlight, although in reality there is nothing like totally perfect mirror.

Just an edit, inside physically based ray tracer (or generally physically based renderer), you should use realistic model of “world” - e.g. your scene shouldn’t contain point lights and such, as point lights doesn’t exist in reality.

In response to reply on a new programming style
Fd80f81596aa1cf809ceb1c2077e190b
0
rouncer 103 Dec 25, 2013 at 09:03

of course an adventure game, just imagine you create an instance from a set of conditions, not just one. and they parent each other, but there is intersecting possible, from anding two types.

so just imagine you have.

elf in forest playing guitar with fairy then fairy dances… that would be possible to insert as a special dependency.

In response to a new programming style
Fd80f81596aa1cf809ceb1c2077e190b
0
rouncer 103 Dec 25, 2013 at 08:44

remember, its just continually cycling the main. whats not here is the actual spawning of the instances, im thinking of how i do that, it may be a handplaced scene, just say for now.

so, pong would be this-> (note when you add a variable, it wont run twice, only once… if it closes a condition and opens it again, then itll run it again, only when it opens a condition does it run.

and you can see, ive reused the coordinate variable for every instance. (the cool thing)

main
{
	run once-> add x coordinate variable
	run once-> add y coordinate variable
	run once-> add instance proximity detector
	run once-> add score variable

	if(im a bat)
	{
		if(key left) x--
		if(key right) x++
	}

	if(im a ball)
	{
		run once-> add angle coordinate
		move ball with angle condition
		run proximity detector.
		if(detect block proximity, using xy coordinates)
		{
			destroy block
			mirror angle
		}

		if(detect bat proximity, using xy coordinates)
		{
			score++
			mirror angle
		}
	}

	if(im a block)
	{
		draw block at coordinate
	}
}

so not very exciting, cause its just pong, but the strange thing you can do, is now turn a ball into a block, or a block into a bat or anything, if you wanted, during the game.

but just it has to check what it is every cycle, and thats the thing i want to fix, if you could fix that, then i would really think this way has its definite use. especially for the nonlinear adventure game… but thats when the speed issue will manifest itself.

Fd80f81596aa1cf809ceb1c2077e190b
0
rouncer 103 Dec 25, 2013 at 08:35

so I guess its an approximation thing, having specular as well as reflection.

If you wanted to have pure physical specular, what variables do you need?

so far ive got, colour rgb, reflection 0-1, refraction 0-1, glossiness, ior, and… shininess?

how would shininess work?

Welcome to DevMaster, a community-driven game development website of posts and resources!

Recent Tags

indie × 4
game-development × 3
android × 2
gaming × 2
design-patterns × 2
windows-phone × 1
music × 1
sound × 1
ios × 1
multiplayer × 1
networking × 1
testing × 1
game-programming × 1
3d-engine × 1
shaders × 1
cross-platform × 1
royalty × 1
game-design × 1
game-industry × 1
graphics × 1
mmo × 1
open-source × 1
mmorpg × 1
gameplay × 1
glsl × 1