Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your feedback on a survey! Each completed response supports our community and gives you a chance to win a $25 Amazon gift card!


Member Since 10 Mar 2008
Offline Last Active Dec 27 2014 11:26 PM

#5200304 Should I use std::cout or have using namespace std; ?

Posted by JohnnyCode on 27 December 2014 - 02:45 PM

Not applying using namespace has severall advantages

1- instant readiblity of code

2- great auto-finish comfort

3- library/modules tracking

4- lesser compile time duties


and the only disadvantage


5- you have to type more


but the disadvantage is greatly negated by auto-finish higher comfort. If you happen to be leaning towards using "using", like if you are aware of 9 mentions of the namespace incoming (rare situation), you still should avoid it, but that is just my personal rule I apply to myself.

#5199690 Problem with tangents (fbx)

Posted by JohnnyCode on 23 December 2014 - 06:47 AM

are you sure the tangents are correct ?

because on top of the head there is this weird area.

That is the seem, they appear where inconsistent mapping happens.  it still can appear in your spectating shader, but should not affect lightning if you use correct handedness of tangent. Stop doubting maya generated tangents finaly

#5199601 What to do after the basics

Posted by JohnnyCode on 22 December 2014 - 04:49 PM


Make something.

Or make a piece of something.


Learning how to make steps that do not fade in vain from point of knowledge is the basics

#5199599 Problem with tangents (fbx)

Posted by JohnnyCode on 22 December 2014 - 04:41 PM

Remeber there are two types of binormals, the one that is truly orthogonal to tangent/ and the one that is cross porduct of the very tangent and of the smoothed normal. The second is wanted , so compute it yourself, and do not pick it from asset defintion, as the asset usualy delivers the real bitangent (the truly orthogonal one- not desired for lightining)

#5199589 Problem with tangents (fbx)

Posted by JohnnyCode on 22 December 2014 - 04:13 PM

bitangents seems incorrect (they should be smooth). Normals are definetly correct, compute the bitangent as the smoothed normal and tangent cross product and display them- if they show smooth, you are all set. And should nat pay attention to tangent vectors not being smooth at all (they never are)

#5199549 Easiest coding language?

Posted by JohnnyCode on 22 December 2014 - 11:46 AM

There are two types of languages from point of develpoment influence on memory, the memory safe (C#, Java, VB.), and then the memory unsafe (c++, pascal, c...)  . If you are a beginner, it still hard to advice what to pick to learn about machine code and obstacles it bring in program runtime. With memory unsafe language, you will learn quite totally what software on computer is and gain experience needed, but if you attempt to do a larger project in memory unsafe language, you may end up giving up the production of the program!


What I would recommend is to learn memory unsafe language, and then move into memory safe language when you get to point of creating a serrious product (I highly recommend to pick memory safe language for production)

#5199542 Problem with tangents (fbx)

Posted by JohnnyCode on 22 December 2014 - 11:15 AM


using tangents/bitangents generated by maya

What are you displaying? Tangents, or normals? You should compute binormal as cross porduct of tangent and smooth normal, then display to yorself smooth normals and binormals, those should be smooth, tangents are never smooth. Tangent are equal for all three verticies and are of very triangle plane contained.

#5197006 Opengl and 8bit indexed textures color[256][3],colorindex[256]

Posted by JohnnyCode on 08 December 2014 - 12:37 PM

Most standard aproach is to have an entire animation texture, for example of resolution 2042*2042 and have 256*256 or 128*128 atlased frames in it. It is up to shader to pick and rasterize desired one, through uniform shader value being issued.  If you want to save memory, you can use 16 bit RGB texture format in ogl texture creation (glTexImage2D), though 8 bit pallete textures are not provided. You can create this 16bit RGB texture from any RGB source image (24bit true color jpeg or png or whatever), this would allow you to upload to GPU twice more textures, since aproach of animating by texture frames is expensive over that.


In case you would really wish to use 8bit textures, what might be sufficient for your production, then you will need to create a (partialy) custom asset, a png image that carries in its 4 channels for sepparate textures. Then load it standardly as a RGBA texture of 8 bits per channel and use that in shaders. This would be most resources saving, but it would complicate the production, since you would have to create this custom 4 channel 32 bit image from your four 256 color textures - in a custom way.

#5195624 Render part of texture with shader

Posted by JohnnyCode on 30 November 2014 - 10:32 PM

A texture, out of its dimension (weheather 256*1024) is always being 1.0*1.0. Strange yet absolute. You should always happen to have your texture to be square, and those squares being a power of two (256/512/1024/2048), but may it be any value, height and width is always reflected agains 1.0/1.0 value, so make it reflect towards thoes, as you try to map those taxtures onto. And if you have an arbitrary picture remaping, compute it towards 1.0/1.0 coordinae of sample , derived from arbitrary map space of texture

#5194298 introducing myself, guidance requested

Posted by JohnnyCode on 23 November 2014 - 12:41 PM


I draw, I make music, I write sometimes and now I have also learnt some coding also (essential Python and some C)

Since you mention C in stead of C++ you have a good programming background/teacher, follow it.


I would like to stress, that in my opinion, you should remain productive especialy in the area you have mentioned, but gaining trivial knowledge of coding would benefit you some, but further knowledge of obstacles and trials of coding, would too, even without your ownself implementing them.


Read and study every topic here on gamedev, as it will enrichen you in procedural defintion area of code runtime behavior (some will not as soon as you think).


But if you remain productive in what you mentioned , namely drawing and possibly music, you can escalate and create a lot, becouse coding is nothing but learning a few rules of code, leaning towards compute munching machine preferances.


Here is a little speed up, that fall and stands on 2d art (2d art is vitaly important in 3d as well, mind that, it creates actual visualization, wheather data is color, or light aproximation)


samorost 1




samorost 2




If you have talent in drawing, feed that, there is no problem though in discovering what technology can simulate of course



#5190394 Normal map artifact still here.

Posted by JohnnyCode on 31 October 2014 - 09:14 AM


I've made simple terrain normals into texture rendering function(without tanget and bitangent calculations). And picture had became good.

So you are using object space normals. With those you do not have this artifact, but if you interpolate light direction vector in pixel shader, you do.

It is a known problem of that direction vectors do not linearily interpolate good on a triangle (on edges only 2 verticies donate interpolation, what can issue in a too big jump if third interpolator was away from zero attribute). But position vectors interpolate good.  So if you will compute light vector in pixel function from interpolated object space position and object space light position, your artefact should dissappear.

#5190338 Efficient array shuffing in pure HLSL

Posted by JohnnyCode on 31 October 2014 - 06:28 AM


Actually I pixelate ("downsample" in some sense) the screen to some extend, say 48 x 48 blocks. Would you then still suggest going the way of goniometric functions, or is there a simpler approach?

You can scale the goniometric function and noise multiplicator the way it suites you to noise your area. In case of noising 1000x1000 screen it would quite do some job. I was understanding that you index [x,y] pixel to a [i] where every i differs for [x,y] unique vector. In case you run a 2d function instead, it is just even more suitable solution.


And if some very reasonable other suggestions here, are not possible for you to perform , you should politely state so.

#5190246 Efficient array shuffing in pure HLSL

Posted by JohnnyCode on 30 October 2014 - 04:36 PM

You need a deterministic function for at least 1 milion values that returns enough noise over them (since you have a determined index for every pixel).


Pretty close to this volatilism demand might be goniometric function , for which you pick period size and way to volatilize y values on sufficient defintion length.


If you reduce to 100000 values and pick definition 0.0-100.0  then x would be multiple of index and constant 1/100.0. You than may decide to volatilize 10 periods of goniometric function by polynome of 10th degree (20 multiplications) - this randomizing polynome is predefined and does not change.

You can pick period size and   polynome size/period size, what allows you to scale the noise and stereotype size.


There are more ways how to achive noise. You may also volatilize polynome definition (its constants) upon index (still determined), or you can experiment with closest prime number to index.

#5185033 Is upper division Linear Algebra a good idea or necessary?

Posted by JohnnyCode on 04 October 2014 - 04:27 PM

I scored 1 from Linear Algebra in first semester from MatFyz (surprised myself). Some people argued over me here that axioma that a vector has the inverse vector, resulting in multiplication neutral vector if those two gets multiplied, with fact that there is no such thing as "multipilaction of vectors" minding and missing that multiplication and addition are operations to be defined on a space (that how you yield a vector space or not).


a vector space on a scalar body is a  space where :


-a vector added to a vector is a vector of the same space

- to each vector exists exclusive vector that when added result in the addition neutral vector (zero vector)

- to each vector exists exclusive multiplication inverse vector ( if multipled with, result in multiplication neutral vector= I  so that I*x=x)

- a vector multiplied by vector is a vector of the space

- .. and a few more axioms


in OpenGL, multiplying is defined as per component throw, such as v*v1=(v.i*v1.i,....i+) vector


This breaks association of vector/matrix multiplication in GLSL/HLSL vector space thus, I was unable to explain recantly, being forced to accept ungenerall rules of linear algebra.


I have to accept this though, since linear algebra in US is studying 3 dimensional spaces only, while on my school it was studying spaces, forced to reduce much lesser defintion.

#5185015 Should i prioritize CPU or Memory usage?

Posted by JohnnyCode on 04 October 2014 - 02:34 PM

if you saw what OS do when you release memory , you would not free it just like that anymore (it keeps the chunk as unavailable memory for 10 secs, - 60 percent of time realocating the same type onto it)


Unless there is a huge amount of data, being needed only some of it-still large- in longer periods of time, then it is a well decision (see  Sik_the_hedgehog post for great example)