# Thergothon

Member

117

160 Neutral

• Rank
Member

## Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

1. ## quick 2d transformation question

All the stuff you have posted makes perfect sense and is exactly how I was looking at the problem. My confusion stemmed from the fact that I am an idiot and was applying the final B' transformation to points in A that had been transformed into the global space to test whether my A->B function was working correctly. Applying the transform: C * GB', to the local points in A is what I should have been doing, and it does in fact work. Thanks for your patience.
2. ## quick 2d transformation question

That all makes sense, I just don't understand how that gives you the final local->global transformation for A. Numbers always help... Say we have two polygons with the following xforms to move them from local->global space: xformA = positionA, orientationA xformB = positionB, orientationB So transform A into Bs local space: xformC.positionC = (positionA - positionB)*orientationBT xformC.orientationC = orientationA*orientationBT ...apply transforms to B over time so xformB is different than the above... Now i want to detach A and be left with a xformA allowing me to transform A to its new world space, how do i calculate xformA given I only know xformC and the new values for xformB? Thanks heaps for your help, I appreciate it :) s.
3. ## quick 2d transformation question

e.g. I have two unit cubes A and B, A is centered at the origin, B is centered at (1, 0), both have a rotation of 0. I want to be able attach A to B, rotate B 180 degrees, then break the two cubes apart and at the end have a world transformation for A that moves it to (2, 0) with a rotation of 180 degrees. How do I do this in a generic way? My thinking is: 1. Move A into the local space of B and store that transformation C 2. Do whatever transforms to B (this step may occur over many many frames) 3. Multiply transform B by the inverse of C to be the new world transform of A? Or is it the other way around? Step 3 is the bit I'm struggling with. Any help would be great, thanks, s [Edited by - Thergothon on September 20, 2008 2:53:16 AM]
4. ## SVG/Vector Graphics

I was thinking about using vector graphics for a few games I'm working on. They are all using abstract line art (with lots of zooms) at the moment, and I think the graphical improvement would be worth the effort of coding some proper vector graphics handling. Are pixel operations going to be quick enough? If so is the process generally the same as rasterizing triangles, in that I would still be setting up left and right pixel buffers for the shapes and then just interpolating the colours across the scan-lines in between?
5. ## SVG/Vector Graphics

I was thinking about playing around with rendering vector graphics and wondering how it is actually done. Is it basically a case of: 1. clip poly-line/curves against screen. 2. recursively sub-divide the result of 1 into segments until the dot product of two consecutive segments directions surpasses some threshold value 3. use some sort of triangulation algorithm (ear-clipping?) to turn the result into a tri-list 4. render ? Is there any articles out there on the subject, I haven't been able to find any myself. Thanks. s.
6. ## solutions for linear systems

Thanks for all the help guys, I'd never even heard of a pseudo-inverse before, that will be a handy thing to remember. As for the link posted by lord crc, it looks perfect, but seriously, they need to republish it in something that isn't Fortran. Once (if) I get it working, I'll definitely post the source here to save others the pain. On Fortran, does it use 1 or 0 based indexing? i.e. 'do 10 i=1, n' equivalent to 'for(size_t i = 1; i <= n; ++i)'. Also does 'sign(sqrt(sq), a(j,j))' mean 'the value of sqrt(sq) with the sign of a(j, j)'? And what does this: 'Relies on FORTRAN77 do-loop conventions!' comment refer to? I can tell this is going to be a nightmare to debug... Once again, your help is much appreciated. s. edit: And could a mod please change the thread title to something like 'finding solutions to linear systems with bounded variables'? Thanks again.
7. ## solutions for linear systems

Lord Crc - Thanks for the link, I'll check it out after work. Zipster - That's a very nice solution. At the moment I don't think the dimensions will work out in the majority of the cases (I haven't quite figured out the dimensions of the vectors or the amount of terms yet), but as far as I understand it, I could pad the vectors with zeros until the dimensions do work out. Would that still give me reasonable results? edit: Actually I don't think that would work. Padding with zeros would give me a determinant of 0, which means I couldn't invert the matrix. I think... [Edited by - Thergothon on September 1, 2008 12:47:13 AM]
8. ## solutions for linear systems

How do I solve a linear system of the form: a0*c0 + a1*c1 + a2*c2 + ... + an*cn = b, where all a's and b and are known vectors, and the rest are scalars such that 0 <= c0, c1, c2, ..., cn <= 1? I remember solving these back in school using gaussian elimination, but I don't ever remember being taught what to do when the constants are constrained like that. Also, a lot of the time this situation this is being used in, will result in systems that have no solution, however I would still like a solution that minimizes the error. Is there a method to do this? An explaination of how, or just the name of the method that I can google/wiki/whatever would be very helpful. Thanks, s.
9. ## D3DXCreateEffect/D3DXCreateEffectFromFile

I can't believe I didn't notice that. Thank you so much.
10. ## D3DXCreateEffect/D3DXCreateEffectFromFile

writing to file: std::string hlsl; test.to_hlsl(hlsl); std::string file_name = "output.fx"; std::ofstream file_output(file_name.c_str()); std::cout.rdbuf(file_output.rdbuf()); std::cout << hlsl << std::endl; file_output.close(); std::cout.rdbuf(log.rdbuf()); ID3DXEffect* effect = 0; ID3DXBuffer* errors = 0; //HRESULT hr = D3DXCreateEffectFromFileA(d3d.m_d3d_device, file_name.c_str(), 0, 0, 0, 0, &effect, &errors); //succeeds HRESULT hr = D3DXCreateEffect(d3d.m_d3d_device, &hlsl, static_cast<unsigned int>(hlsl.size()), 0, 0, 0, 0, &effect, &errors); //fails if(FAILED(hr)) { switch(hr) { case D3DERR_INVALIDCALL: std::cout << "invalid call" << std::endl; break; case D3DXERR_INVALIDDATA: std::cout << "invalid data" << std::endl; break; case E_OUTOFMEMORY: std::cout << "out of memory" << std::endl; break; default: std::cout << "failed" << std::endl; } if(errors) { char* ptr = static_cast<char*>(errors->GetBufferPointer()); for(unsigned int i = 0; i < errors->GetBufferSize(); ++i) std::cout << ptr; std::cout << std::endl; } } log output: failed ID3DXEffectCompiler: There were no techniques ID3DXEffectCompiler: Compilation failed shader file output. intentionally simple case, but always fails with the same error, no matter how long the ps code is: float4 ps(in float2 input: TEXCOORD0) : COLOR { float var0 = input.x; return var0; } technique main { pass P0 { VertexShader = 0; PixelShader = compile ps_3_0 ps(); } }
11. ## D3DXCreateEffect/D3DXCreateEffectFromFile

I'm writing a program that needs to generate pixel shaders at runtime. Everything works perfectly except that I need to write the string that contains the shader out to a file and load it back in though D3DXCreateEffectFromFile. If I attempt to use D3DXCreateEffect directly, it fails with the following error: ID3DXEffectCompiler: There were no techniques ID3DXEffectCompiler: Compilation failed Has anyone seen this before? It's not too big of a problem, and I can live with using D3DXCreateEffectFromFile, but I would prefer to sort it out, as writing data to disk just to load it again seems unnecessary and messy.
12. ## Interval Arithmetic

I'll give boost::interval a try now that I have a grasp on how this stuff actually works. Thanks. Edit: Interval arithmetic is amazing. My ray tracer for implicits is now well over 30 times faster than it was. Time to check out affine arithmetic. [Edited by - Thergothon on April 8, 2008 10:05:17 PM]
13. ## Interval Arithmetic

Thanks for the help guys. I just realized I also made a mistake in the first post with the addition example, which probably made my question more confusing than it should have been. Embarrassing. Sorry. Anyway, this is what I've got for interval/scalar arithmetic: interval& interval::operator += (float scalar) { a += scalar; b += scalar; return *this; } interval& interval::operator -= (float scalar) { a -= scalar; b -= scalar; return *this; } interval& interval::operator *= (float scalar) { if(scalar < 0.0f) std::swap(a, b); a *= scalar; b *= scalar; return *this; } is that correct? All the interval/interval stuff I've figured out from various papers I've read, they just seem to skip over interval/scalar stuff. Finally, for testing intervals against functions in N-dimensional space, should I be substituting all the intervals in all axes into the function simultaneously, or should I be testing each axis independently?
14. ## Interval Arithmetic

I'm trying to speed up a ray marcher I quickly wrote by using interval arithmetic, but I'm not sure I quite understand what I am doing. Given that I have a volume in 3d space defined by 3 intervals, one for each axis, plus an equation for an implicit surface, say a sphere. If I substitute the variables for the sphere with the intervals and evaluate the function, then I get another interval. If the high value of the interval is less than zero then volume is entirely inside the sphere, if the low value is higher greater than zero then the volume is entirely outside of the sphere. Otherwise the volume straddles the sphere. Is this correct? Also, is it possible to perform an operation between an interval and a scalar? eg [3, 5] + 4 = [7, 9]? If so are +/-/*/'/' all done in a piecewise fashion as you would between two scalars? [Edited by - Thergothon on April 8, 2008 9:29:39 AM]
15. ## Cloud Generation and Rendering

I'm interested in finding out what is currently state of the art in off-line volumetric cloud rendering. So far the only recent papers I've found are Nishita & Dobashi's stuff on single/multiple scattering + animation using grid based fluid dynamics, but they are relatively old. Is there any new techniques that anybody knows of, particularly in regards to cloud form and animation?